|
Including kApplyOpsCmd to shouldRecordChangeStreamPreImage would not resolve the issue because the change stream pre-image recorded on the primary would have an invalid timestamp (0,0) that is not representative of the update ((1649864643, 3) in this example).
Oplog (note the latest entry indicating we had written a change stream pre-image with timestamp 0,0) :
{ "op" : "c", "ns" : "admin.$cmd", "o" : { "applyOps" : [ { "op" : "d", "ns" : "config.system.preimages", "ui" : UUID("40a7ae9a-5e7c-459f-8c54-1430139e34fe"), "o" : { "_id" : { "nsUUID" : UUID("6010325b-ecc9-48ab-ab82-7dd9d2ea0216"), "ts" : Timestamp(0, 0), "applyOpsIndex" : NumberLong(0) } } } ] }, "ts" : Timestamp(1649864653, 1), "t" : NumberLong(1), "v" : NumberLong(2), "wall" : ISODate("2022-04-13T15:44:13.176Z") }
|
{ "op" : "c", "ns" : "test.$cmd", "o" : { "applyOps" : [ { "op" : "u", "ns" : "test.c", "o2" : { "_id" : 1 }, "o" : { "$set" : { "a" : "b" } }, "ui" : UUID("6010325b-ecc9-48ab-ab82-7dd9d2ea0216") } ], "lsid" : { "id" : UUID("56643d1f-5fe4-4eef-a33a-53dee297df98") }, "$clusterTime" : { "clusterTime" : Timestamp(1649864643, 2), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "$db" : "test" }, "ts" : Timestamp(1649864643, 3), "t" : NumberLong(1), "v" : NumberLong(2), "wall" : ISODate("2022-04-13T15:44:03.526Z") }
|
{ "op" : "i", "ns" : "test.c", "ui" : UUID("6010325b-ecc9-48ab-ab82-7dd9d2ea0216"), "o" : { "_id" : 1, "a" : "a" }, "o2" : { "_id" : 1 }, "ts" : Timestamp(1649864643, 2), "t" : NumberLong(1), "v" : NumberLong(2), "wall" : ISODate("2022-04-13T15:44:03.510Z") }
|
{ "op" : "c", "ns" : "test.$cmd", "ui" : UUID("6010325b-ecc9-48ab-ab82-7dd9d2ea0216"), "o" : { "create" : "c", "changeStreamPreAndPostImages" : { "enabled" : true }, "idIndex" : { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_" } }, "ts" : Timestamp(1649864643, 1), "t" : NumberLong(1), "v" : NumberLong(2), "wall" : ISODate("2022-04-13T15:44:03.474Z") }
|
Primary:
MongoDB Enterprise replset:PRIMARY> db.getSiblingDB('config').system.preimages.find().itcount()
|
0
|
Secondary:
MongoDB Enterprise replset:SECONDARY> db.getSiblingDB('config').system.preimages.find()
|
{ "_id" : { "nsUUID" : UUID("6010325b-ecc9-48ab-ab82-7dd9d2ea0216"), "ts" : Timestamp(1649864643, 3), "applyOpsIndex" : NumberLong(0) }, "operationTime" : ISODate("2022-04-13T15:44:03.526Z"), "preImage" : { "_id" : 1, "a" : "a" } }
|
|