-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Catalog and Routing
-
None
-
3
-
TBD
-
🟦 Shard Catalog
-
None
-
None
-
None
-
None
-
None
-
None
A primary node generates a create collection oplog entry where a new collections uuid is stored in the ui field, and stripped from the o field.
Ex:
db.adminCommand({ Â applyOps: [ Â Â { Â Â Â op: "c", Â Â Â ns: "test.$cmd", ui: field defined. Â Â Â o: { Â Â Â Â create: "myCollection", // UUID explicitly removed from 'o' document. Â Â Â } Â Â } Â ] });
However, a user initiated applyOps isn't bound by the contract the 'uuid' doesn't belong inside the 'o' subObject.
Pre-existing behavior for applyOps:Â
- Â If o.uuidi is present + ui is none = use o.uuid
db.adminCommand({ Â applyOps: [ Â Â { Â Â Â op: "c", Â Â Â ns: "test.$cmd", // no 'ui' field defined. Â Â Â o: { Â Â Â Â create: "myCollection", Â Â Â Â uuid: UUID("ae985829-b672-4309-a10b-1f763ec07de9") Â Â Â } Â Â } Â ] }); // Currently, true assert(bsonBinaryEqual(db.getCollection("myCollection").getUUID(), Â Â Â Â Â Â Â Â Â Â Â UUID("ae985829-b672-4309-a10b-1f763ec07de9")));
Where 'cmdObj.addField' replaces o.uuid only if ui exists. Otherwise, CollectionOptions are parsed with o.uuid.
It is unclear whether this behavior is intentional, or a side effect of how the code was written. At the very least, the code should document the expected behavior - especially when both fields are present and conflict.
Note: If the presence of o.uuid should throw, we should assess the risk with existing downstream tools.
- related to
-
SERVER-105847 Split up createCollectionForApplyOps logic
-
- Closed
-