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

Hashing of _id during application of oplog entries must respect the collation

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.11
    • Component/s: Querying, Replication
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Query 2016-08-29

      Description

      Suppose that a user issues the following operations:

      db.createCollection("c", {collation: {locale: "en_US", strength: 2}});
      db.c.insert({_id: "foo"});
      db.c.remove({_id: "FOO"});
      

      Here the collection default collation is case-insensitive, so the expected state of the collection after these commands are issued is to be empty. The replication system, however, may distribute oplog application work on the secondary based on the hash of the _id. This hash is currently not collation-aware. As a consequence, the two operations may get assigned to different applier workers and could get applied in the wrong order. The result would be data corruption, since the primary would have no documents, but the secondary would have the document {_id: "foo"}.

      The simplest fix is to change fillWriterVectors() to assign all oplog entries where the collection has a non-simple collation to the same vector.

        Attachments

          Activity

            People

            Assignee:
            david.storch David Storch
            Reporter:
            david.storch David Storch
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: