When resharding clones the retryable write session info to a recipient, the TransactionParticipant's affectedNamespaces is cloned over as "admin.$cmd", rather than the actual collection name that received the write.
The following is observed:
1. Resharding starts
2. A batched insert (with featureFlagReplicateVectoredInsertsTransactionally enabled) to the donor shard produces the following opLog entry:
{ lsid: { id: new UUID("b1cc56c0-5e8e-4d2b-8214-b57862671656"), uid: Binary(Buffer.from("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "hex"), 0) }, txnNumber: Long("0"), op: 'c', ns: 'admin.$cmd', o: { applyOps: [ { op: 'i', ns: 'test.foo', ui: new UUID("e261a21a-d619-4a2a-bdda-8ab97a704abc"), o: { _id: ObjectId("6708f8bfeca9cf5157b53d81"), a: 1, x: -1 }, o2: { x: -1, _id: ObjectId("6708f8bfeca9cf5157b53d81") }, destinedRecipient: 'repro-bf-35320-2-rs1', stmtId: 0 }, { op: 'i', ns: 'test.foo', ui: new UUID("e261a21a-d619-4a2a-bdda-8ab97a704abc"), o: { _id: ObjectId("6708f8bfeca9cf5157b53d82"), a: 2, x: -1 }, o2: { x: -1, _id: ObjectId("6708f8bfeca9cf5157b53d82") }, destinedRecipient: 'repro-bf-35320-2-rs1', stmtId: 1 } ] }, ts: Timestamp({ t: 1728641215, i: 5 }), t: Long("1"), v: Long("2"), wall: ISODate("2024-10-11T10:06:55.618Z"), prevOpTime: { ts: Timestamp({ t: 0, i: 0 }), t: Long("-1") }, multiOpType: 1 }
3. Resharding clones this session info to the recipient and produces the following oplog entry (notice the o2.ns field is "admin.$cmd") :
{ lsid: { id: new UUID("b1cc56c0-5e8e-4d2b-8214-b57862671656"), uid: Binary(Buffer.from("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "hex"), 0) }, txnNumber: Long("0"), op: 'n', ns: 'admin.$cmd', o: { '$sessionMigrateInfo': 1 }, o2: { lsid: { id: new UUID("b1cc56c0-5e8e-4d2b-8214-b57862671656"), uid: Binary(Buffer.from("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "hex"), 0) }, txnNumber: Long("0"), op: 'c', ns: 'admin.$cmd', o: { applyOps: [ { op: 'i', ns: 'test.foo', ui: new UUID("e261a21a-d619-4a2a-bdda-8ab97a704abc"), o: { _id: ObjectId("6708f8bfeca9cf5157b53d81"), a: 1, x: -1 }, o2: { x: -1, _id: ObjectId("6708f8bfeca9cf5157b53d81") }, destinedRecipient: 'repro-bf-35320-2-rs1', stmtId: 0 }, { op: 'i', ns: 'test.foo', ui: new UUID("e261a21a-d619-4a2a-bdda-8ab97a704abc"), o: { _id: ObjectId("6708f8bfeca9cf5157b53d82"), a: 2, x: -1 }, o2: { x: -1, _id: ObjectId("6708f8bfeca9cf5157b53d82") }, destinedRecipient: 'repro-bf-35320-2-rs1', stmtId: 1 } ] }, ts: Timestamp({ t: 1728641215, i: 5 }), t: Long("1"), v: Long("2"), wall: ISODate("2024-10-11T10:06:55.618Z"), prevOpTime: { ts: Timestamp({ t: 0, i: 0 }), t: Long("-1") }, multiOpType: 1, _id: { clusterTime: Timestamp({ t: 1728641215, i: 5 }), ts: Timestamp({ t: 1728641215, i: 5 }) } }, stmtId: [ 0, 1 ], fromMigrate: true, ts: Timestamp({ t: 1728641216, i: 8 }), t: Long("1"), v: Long("2"), wall: ISODate("2024-10-11T10:06:56.298Z"), prevOpTime: { ts: Timestamp({ t: 0, i: 0 }), t: Long("-1") } }
4. If at a later time the recipient shard needs to follow this session's oplog chain to reconstruct a TransactionParticipant's state, it will add "admin.$cmd" as affectedNamespace, instead of the original namespace (test.foo in this case). This is because when TransactionParticipant processes the entry in (3), it will observe that entry.getNss() (o2.ns) is "admin.$cmd".
- related to
-
SERVER-96052 Investigate all possible types of writes during resharding that can result in bugs like SERVER-95724
- Open
-
SERVER-96041 Measure performance impact of processing vectored insert oplog entries
- Backlog