Restrict SortedDataInterface::seekExact to only return exact KeyString matches

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.2.0
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • None
    • Fully Compatible
    • Execution Team 2021-11-15, Execution Team 2021-11-29, Execution Team 2021-12-13
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-42972 allowed seekExact take a KeyString, but implementations really only search for approximate KeyStrings that match a prefix. This is because most indexes (non-_id) append RecordIds to their keys.

      We can narrow the scope of the function so that it's semantics are more obvious. That is: only return exact KeyString matches. Don't try to compare without the RecordId just to satisfy the API.

      Additionally, IndexAccessMethod::findSingle() is the only caller of SortedDataInterface::seekExact. And index lookups on the _id index are the only callers of findSingle().

      For example: all indexes but the _id index store keys as the concatenation of KeyString+RecordId. If I seek with seekExact on the _id index, I simply pass that key to the storage engine and get a match. If I seek with seekExact on a non-_id index, it would be incorrect to ever return a key, because there will never be an exact match unless a RecordID is also part of the seeked-for KeyString (and that is pointless).

            Assignee:
            Louis Williams
            Reporter:
            Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: