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

Make clustered collection scan respect min bounds

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • Execution Team 2021-10-04, Execution Team 2021-10-18

      Inside collection_scan.cpp atEndOfRangeInclusive() is used to determine if a recordId is exceeds beyond the end bound. However, there is no check whether a recordId is before the start bound.Consider the following:

      Recall RecordIds generated from type ‘objectId’ begin with typebits 78, RecordIds generated from type ‘date’ begin with typebits 64

      • Suppose recId0 is generated from a date type (begins with 64)
      • maxRecord = 78***, minRecord = 78** (both of type ObjectId)
      • Inside CollectionScan::returnIfMatches(), we are not inside at the end of the rangeBound, and there is no filter provided so it passes the filter and returns PlanStage::Advanced
      • The caller of returnIfMatches will think there is new work to be done with the document found (recId0)
      • This means a result of different type than the bounds may be misinterpreted as within the bounds

      Instead of returning PlanStage::Advanced, returnIfMatches should check if the recId found is outside the start bound, and return PlanStage::NEED_TIME if so to prompt another pass

            Assignee:
            haley.connelly@mongodb.com Haley Connelly
            Reporter:
            haley.connelly@mongodb.com Haley Connelly
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: