-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.0.15, 3.2.17, 3.4.9, 3.5.13
-
Component/s: Replication, Write Ops
-
ALL
-
-
Query 2020-10-05
The Oplog Application Idempotency project found the following bug:
Starting with a document { _id: 1, a: 0 }; Apply: o: { $unset: { a: null } } ==> { _id: 1 }; Apply: o: { $set: { 'a.c': 1, b: null } } ==> { _id: 1, a: { c: 1 }, b: null }; // Applying the updates again: Apply: o: { $unset: { a: null } } ==> { _id: 1, b: null }; Apply: o: { $set: { 'a.c': 1, b: null } } ==> { _id: 1, b: null, a: { c: 1 } };
Impact
Initial sync, replication rollback, and replication recovery following an unclean shutdown may apply a sequence of operations twice and therefore depend on oplog application being idempotent. It is possible that after applying a sequence of operations twice for a document to contain the same field-value pairs, but for the fields to be order differently within the document. While MongoDB replication subsystem has never promised to preserve the order of fields across documents on the primary and secondary, not doing so is problematic for two reasons:
- The "dbhash" command takes the md5sum of the contents of each collection. Having a different field ordering between the primary and secondary will lead to a dbhash mismatch. There was a similar issue with the $rename update modifier that was addressed in
SERVER-21647. - Queries of the form {a: {x: 1, y: 2}} will not match the document {_id: 0, a: {y: 2, x: 1}} (see SERVER-5030), so it is possible for the query when run a primary to return the document and for the query when run on a secondary to not return the document.
- related to
-
SERVER-50300 Log $v:2 update oplog entries from the modifier style update system
- Closed