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.
- related to
-
SERVER-61427 Unique index builds can cause a loss of availability during commit due to checking many false duplicates
- Closed