Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-18461

Range predicates comparing against a BinData value should be covered, but are not in 2.6

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.6.8
    • Fix Version/s: 2.6.11, 3.0.5, 3.1.4
    • Component/s: Querying
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Completed:
    • Steps To Reproduce:
      Hide

      Create a collection with following documents

      { "_id" : BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv"), "a" : 1 }
      { "_id" : BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhz"), "a" : 2 }
       
      Create an index on {_id:1, a:1}
       
      execute the following query
      db.<collection>.find({"$and": [{"_id": {"$lte": new BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv")}},{"_id": {"$gte": new BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv")}}]}, {"_id":1, "a":1}).hint("_id_1_a_1").explain()
      

      Show
      Create a collection with following documents { "_id" : BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv"), "a" : 1 } { "_id" : BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhz"), "a" : 2 }   Create an index on {_id:1, a:1}   execute the following query db.<collection>.find({"$and": [{"_id": {"$lte": new BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv")}},{"_id": {"$gte": new BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv")}}]}, {"_id":1, "a":1}).hint("_id_1_a_1").explain()

      Description

      We only allow covering for predicates that can be answered exactly via an index scan. The "tightness" of the bounds is called EXACT in this case. If the bounds are not EXACT, then in order to answer the predicate we must fetch the full document and pass it through the filter.

      The 2.6 and 3.0 query engine does not consider range predicates against BinData values EXACT, which means that such queries cannot be covered. However, the 2.4 query engine would allow such predicates to be answered without fetching the document. We should restore the 2.4 behavior.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: