summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough
diff options
context:
space:
mode:
authorJosef Ahmad <josef.ahmad@mongodb.com>2022-01-13 11:21:43 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-13 12:12:05 +0000
commit5a1dbe698bf88ef3f0ce2348c705d6a042c32011 (patch)
tree770e9b2da7fdb55d4b204d69b7b72334e8ccccc8 /jstests/noPassthrough
parent546d77f0945fabc0fc485e762bd7548871ffc601 (diff)
downloadmongo-5a1dbe698bf88ef3f0ce2348c705d6a042c32011.tar.gz
SERVER-61709 Introduce implicitly replicated namespaces
Implicitly replicated namespaces are internal namespaces that do not replicate writes, with the exception of deletions, user-initiated direct writes and some maintenance operations. This patch lists config.system.preimages, config.images_collection, config.transactions and config.changes.* as implicitly replicated namespaces, and unifies and validates their semantics. It also special-cases some of the config.transactions replication behaviour that is too specific to be generalised.
Diffstat (limited to 'jstests/noPassthrough')
-rw-r--r--jstests/noPassthrough/change_streams_pre_image_removal_job.js10
-rw-r--r--jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js4
2 files changed, 13 insertions, 1 deletions
diff --git a/jstests/noPassthrough/change_streams_pre_image_removal_job.js b/jstests/noPassthrough/change_streams_pre_image_removal_job.js
index cb9ba2e8c17..6d7ca7253ee 100644
--- a/jstests/noPassthrough/change_streams_pre_image_removal_job.js
+++ b/jstests/noPassthrough/change_streams_pre_image_removal_job.js
@@ -41,6 +41,7 @@ rst.startSet({setParameter: {expiredChangeStreamPreImageRemovalJobSleepSecs: 1}}
rst.initiate();
const primaryNode = rst.getPrimary();
const testDB = primaryNode.getDB(jsTestName());
+const localDB = primaryNode.getDB("local");
const collA =
assertCreateCollection(testDB, "collA", {changeStreamPreAndPostImages: {enabled: true}});
const collB =
@@ -59,7 +60,8 @@ for (const coll of [collA, collB]) {
// Pre-images collection should contain four pre-images.
preImages = getPreImages(primaryNode);
-assert.eq(preImages.length, 4, preImages);
+const preImagesToExpire = 4;
+assert.eq(preImages.length, preImagesToExpire, preImages);
// Roll over all current oplog entries.
const lastOplogEntryToBeRemoved = getLatestOp(primaryNode);
@@ -96,6 +98,12 @@ assert.soon(() => {
return onlyTwoPreImagesLeft && allPreImagesHaveBiggerTimestamp;
});
+// Because the pre-images collection is implicitly replicated, validate that writes do not generate
+// oplog entries, with the exception of deletions.
+const preimagesNs = 'config.system.preimages';
+assert.eq(preImagesToExpire, localDB.oplog.rs.find({op: 'd', ns: preimagesNs}).itcount());
+assert.eq(0, localDB.oplog.rs.find({op: {'$ne': 'd'}, ns: preimagesNs}).itcount());
+
// Verify that pre-images collection content on the primary node is the same as on the
// secondary.
rst.awaitReplication();
diff --git a/jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js b/jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js
index 67bb79af9ae..a54b2cf0fb0 100644
--- a/jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js
+++ b/jstests/noPassthrough/store_retryable_find_and_modify_images_in_side_collection.js
@@ -336,6 +336,10 @@ function runTests(lsid,
retryRes = assert.commandWorked(mainConn.getDB('test').runCommand(cmd));
assertRetryCommand(res, retryRes);
+ // Because the config.image_collection table is implicitly replicated, validate that writes do
+ // not generate oplog entries, with the exception of deletions.
+ assert.eq(0, oplog.find({ns: "config.image_collection", op: {'$ne': 'd'}}).itcount());
+
assert(mainConn.getDB('test').user.drop());
}