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

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

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.11
    • Affects Version/s: None
    • Component/s: Querying, Replication
    • None
    • Fully Compatible
    • Query 2016-08-29

      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.

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

              Created:
              Updated:
              Resolved: