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

Support upsert duplicate key retry if unique index has collation

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • Fully Compatible
    • v8.0, v7.0, v6.0

      Currently if upsert fails with duplicate key error because of a unique index, we might retry it if the query exactly matches the unique index.

      This is done to allow for two concurrent upserts of the same documents to succeed.

      However, if the unique index has collation, we won't retry because of this check where we compare index key to query predicate value: https://github.com/mongodb/mongo/blob/83a7377aa1071cf07d7ef9c8a4f3fdee782f7c5b/src/mongo/db/ops/write_ops_exec.cpp#L2275

      But if index has collation, the key there would be CollationKey, not raw value. So this check is never passed.

      This is was discovered during fix for SERVER-84089

            Assignee:
            ivan.fefer@mongodb.com Ivan Fefer
            Reporter:
            ivan.fefer@mongodb.com Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: