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

Improve SortedDataInterface::insert semantics

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 6.0.0-rc0
    • None
    • Fully Compatible
    • Execution Team 2022-03-07, Execution Team 2022-03-21

    Description

      Prior to SERVER-61427, the comment for SortedDataInterface::insert stated that a DuplicateKey error will be returned if `dupsAllowed` is false and the prefix of the key matches a key already in the index but the RecordId at the ends of the keys do not match. However, this comment is not accurate, as the function actually returned a DuplicateKey error any time the prefix key matches, regardless of the RecordId.

      For the sake of backport safety, SERVER-61427 changed this function to return a `StatusWith<bool>`. If `dupsAllowed` is true and the entire key, including RecordId, matches a key in the index, the function will return false. However, it would likely be improvement for the semantics of this interface if we undo this `StatusWith<bool>` change, and instead make the function actually follow the behavior described by its previous comment; that is, if `dupsAllowed` is false and the key inserted matches in prefix and RecordId, we do not return a DuplicateKey error.

      Attachments

        Issue Links

          Activity

            People

              gregory.noma@mongodb.com Gregory Noma
              gregory.noma@mongodb.com Gregory Noma
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: