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

audit the use of SortedDataInterface::Cursor::seek for full index traversal in our tests

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 4.3.1
    • 3.3.5
    • Storage
    • Fully Compatible
    • ALL
    • Execution Team 2019-09-09

    Description

      There are a number of places where we traverse an index by seeking to kMinBSONKey:

      for (auto entry = cursor->seek(kMinBSONKey, true); entry; i++, entry = cursor->next()) 
      

      This is correct only for non-compound indexes and may confuse future readers who may want to use it for traversing a generic index. Whenever possible, we should seek to BSONObj() instead of kMinBSONKey; this will seek to the leftmost document in the index, regardless of the index type.

      Attachments

        Activity

          People

            haley.connelly@mongodb.com Haley Connelly
            robert.guo@mongodb.com Robert Guo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: