diff options
author | Romans Kasperovics <romans.kasperovics@mongodb.com> | 2022-11-09 21:36:43 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-09 22:33:18 +0000 |
commit | 4e627d89600f0e00de57dd299e7fe3804f2a8c3f (patch) | |
tree | 741e664c8f6250196c0c4d5f89e59eb8f701a553 /jstests | |
parent | f57f1b491d77b31e87c9f243af4e30f793ed3e15 (diff) | |
download | mongo-4e627d89600f0e00de57dd299e7fe3804f2a8c3f.tar.gz |
SERVER-70796 Remove batchedExpiredChangeStreamPreImageRemoval parameter
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthrough/change_streams_pre_image_removal_job.js | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/jstests/noPassthrough/change_streams_pre_image_removal_job.js b/jstests/noPassthrough/change_streams_pre_image_removal_job.js index 09b37951157..274153370b3 100644 --- a/jstests/noPassthrough/change_streams_pre_image_removal_job.js +++ b/jstests/noPassthrough/change_streams_pre_image_removal_job.js @@ -79,8 +79,7 @@ function retryOnCappedPositionLostError(func, message) { // oplog entries of the previously recorded pre-images. Afterwards two updates are performed and // therefore two new pre-images are recorded. The pre-images removal job must remove only the first // four recorded pre-images. -// 'batchedDelete' determines whether pre-images will be removed in batches or document-by-document. -function testPreImageRemovalJob(batchedDelete) { +{ // Roll over the oplog, leading to 'PeriodicChangeStreamExpiredPreImagesRemover' periodic job // deleting all pre-images. let lastOplogEntryToBeRemoved = getLatestOp(primaryNode); @@ -90,10 +89,6 @@ function testPreImageRemovalJob(batchedDelete) { } assert.soon(() => getPreImages(primaryNode).length == 0); - // Set the 'batchedExpiredChangeStreamPreImageRemoval'. - assert.commandWorked(primaryNode.adminCommand( - {setParameter: 1, batchedExpiredChangeStreamPreImageRemoval: batchedDelete})); - // Drop and recreate the collections with pre-images recording. const collA = assertDropAndRecreateCollection( testDB, "collA", {changeStreamPreAndPostImages: {enabled: true}}); @@ -143,33 +138,24 @@ function testPreImageRemovalJob(batchedDelete) { // 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'; - if (batchedDelete) { - // Multi-deletes are batched base on time before performing the deletion, therefore the - // deleted pre-images can span through multiple applyOps oplog entries. - // - // As pre-images span two collections, the minimum number of batches is 2, as we perform - // the range-deletion per collection. The maximum number of batches is 4 (one per single - // pre-image removed). - const expectedNumberOfBatchesRange = [2, 3, 4]; - const serverStatusBatches = testDB.serverStatus()['batchedDeletes']['batches']; - const serverStatusDocs = testDB.serverStatus()['batchedDeletes']['docs']; - assert.contains(serverStatusBatches, expectedNumberOfBatchesRange); - assert.eq(serverStatusDocs, preImagesToExpire); - assert.contains( - retryOnCappedPositionLostError( - () => - localDB.oplog.rs - .find( - {ns: 'admin.$cmd', 'o.applyOps.op': 'd', 'o.applyOps.ns': preimagesNs}) - .itcount(), - "Failed to fetch oplog entries for pre-image deletes"), - expectedNumberOfBatchesRange); - } else { - assert.eq(preImagesToExpire, - retryOnCappedPositionLostError( - () => localDB.oplog.rs.find({op: 'd', ns: preimagesNs}).itcount(), - "Failed to fetch oplog entries for pre-image deletes")); - } + // Multi-deletes are batched base on time before performing the deletion, therefore the + // deleted pre-images can span through multiple applyOps oplog entries. + // + // As pre-images span two collections, the minimum number of batches is 2, as we perform + // the range-deletion per collection. The maximum number of batches is 4 (one per single + // pre-image removed). + const expectedNumberOfBatchesRange = [2, 3, 4]; + const serverStatusBatches = testDB.serverStatus()['batchedDeletes']['batches']; + const serverStatusDocs = testDB.serverStatus()['batchedDeletes']['docs']; + assert.contains(serverStatusBatches, expectedNumberOfBatchesRange); + assert.eq(serverStatusDocs, preImagesToExpire); + assert.contains( + retryOnCappedPositionLostError( + () => localDB.oplog.rs + .find({ns: 'admin.$cmd', 'o.applyOps.op': 'd', 'o.applyOps.ns': preimagesNs}) + .itcount(), + "Failed to fetch oplog entries for pre-image deletes"), + expectedNumberOfBatchesRange); assert.eq(0, retryOnCappedPositionLostError( () => localDB.oplog.rs.find({op: {'$ne': 'd'}, ns: preimagesNs}).itcount(), @@ -181,10 +167,6 @@ function testPreImageRemovalJob(batchedDelete) { assert(bsonWoCompare(getPreImages(primaryNode), getPreImages(rst.getSecondary())) === 0); } -for (const batchedDelete of [false, true]) { - testPreImageRemovalJob(batchedDelete); -} - // Increase oplog size on each node to prevent oplog entries from being deleted which removes a // risk of replica set consistency check failure during tear down of the replica set. const largeOplogSizeMB = 1000; |