diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2021-05-17 22:26:46 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-18 02:58:27 +0000 |
commit | 162e0d14fe2944b8e782263539944d41f1f3d0c9 (patch) | |
tree | 9e4cda8ad9d8add760fb38fa9be06ed363b20ba8 | |
parent | b0e213e963fe9ca76fb07212c6c2a1c9316af060 (diff) | |
download | mongo-162e0d14fe2944b8e782263539944d41f1f3d0c9.tar.gz |
SERVER-56953: Allow testing for new-style retryable findAndModify for basic operations.
13 files changed, 65 insertions, 4 deletions
diff --git a/buildscripts/resmokeconfig/suites/tenant_migration_causally_consistent_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/tenant_migration_causally_consistent_jscore_passthrough.yml index 09b03fe85d1..edc3c0b8214 100644 --- a/buildscripts/resmokeconfig/suites/tenant_migration_causally_consistent_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/tenant_migration_causally_consistent_jscore_passthrough.yml @@ -252,6 +252,9 @@ executor: # so. Therefore, the garbage collection delay doesn't need to be large. tenantMigrationGarbageCollectionDelayMS: 1 ttlMonitorSleepSecs: 1 + # Tenant migrations is not currently compatible with implicitly replicated retryable + # findAndModify images. + storeFindAndModifyImagesInSideCollection: false tlsMode: allowTLS tlsCAFile: jstests/libs/ca.pem tlsAllowInvalidHostnames: '' diff --git a/buildscripts/resmokeconfig/suites/tenant_migration_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/tenant_migration_jscore_passthrough.yml index c3bc832f592..af299b7abf0 100644 --- a/buildscripts/resmokeconfig/suites/tenant_migration_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/tenant_migration_jscore_passthrough.yml @@ -175,6 +175,9 @@ executor: # so. Therefore, the garbage collection delay doesn't need to be large. tenantMigrationGarbageCollectionDelayMS: 1 ttlMonitorSleepSecs: 1 + # Tenant migrations is not currently compatible with implicitly replicated retryable + # findAndModify images. + storeFindAndModifyImagesInSideCollection: false tlsMode: allowTLS tlsCAFile: jstests/libs/ca.pem tlsAllowInvalidHostnames: '' diff --git a/buildscripts/resmokeconfig/suites/tenant_migration_kill_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/tenant_migration_kill_primary_jscore_passthrough.yml index e19b2719760..c0e183bfb32 100644 --- a/buildscripts/resmokeconfig/suites/tenant_migration_kill_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/tenant_migration_kill_primary_jscore_passthrough.yml @@ -301,6 +301,9 @@ executor: # so. Therefore, the garbage collection delay doesn't need to be large. tenantMigrationGarbageCollectionDelayMS: 1 ttlMonitorSleepSecs: 1 + # Tenant migrations is not currently compatible with implicitly replicated retryable + # findAndModify images. + storeFindAndModifyImagesInSideCollection: false tlsMode: allowTLS tlsCAFile: jstests/libs/ca.pem tlsAllowInvalidHostnames: '' diff --git a/buildscripts/resmokeconfig/suites/tenant_migration_multi_stmt_txn_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/tenant_migration_multi_stmt_txn_jscore_passthrough.yml index 8b480876583..20acf6d1414 100644 --- a/buildscripts/resmokeconfig/suites/tenant_migration_multi_stmt_txn_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/tenant_migration_multi_stmt_txn_jscore_passthrough.yml @@ -430,6 +430,9 @@ executor: tlsAllowInvalidHostnames: '' auth: '' keyFile: *keyFile + # Tenant migrations is not currently compatible with implicitly replicated retryable + # findAndModify images. + storeFindAndModifyImagesInSideCollection: false per_mongod_options: # Each entry is for a different replica set's extra mongod options. - tlsCertificateKeyFile: jstests/libs/rs0.pem diff --git a/buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml index 18d7ef78952..6d7d6381375 100644 --- a/buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml @@ -296,6 +296,9 @@ executor: # so. Therefore, the garbage collection delay doesn't need to be large. tenantMigrationGarbageCollectionDelayMS: 1 ttlMonitorSleepSecs: 1 + # Tenant migrations is not currently compatible with implicitly replicated retryable + # findAndModify images. + storeFindAndModifyImagesInSideCollection: false tlsMode: allowTLS tlsCAFile: jstests/libs/ca.pem tlsAllowInvalidHostnames: '' diff --git a/buildscripts/resmokeconfig/suites/tenant_migration_terminate_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/tenant_migration_terminate_primary_jscore_passthrough.yml index e5186524cad..65e347bb480 100644 --- a/buildscripts/resmokeconfig/suites/tenant_migration_terminate_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/tenant_migration_terminate_primary_jscore_passthrough.yml @@ -302,6 +302,9 @@ executor: tlsAllowInvalidHostnames: '' auth: '' keyFile: *keyFile + # Tenant migrations is not currently compatible with implicitly replicated retryable + # findAndModify images. + storeFindAndModifyImagesInSideCollection: false per_mongod_options: # Each entry is for a different replica set's extra mongod options. - tlsCertificateKeyFile: jstests/libs/rs0.pem diff --git a/buildscripts/resmokelib/mongod_fuzzer_configs.py b/buildscripts/resmokelib/mongod_fuzzer_configs.py index 3277cb6a5b8..17b3443613b 100644 --- a/buildscripts/resmokelib/mongod_fuzzer_configs.py +++ b/buildscripts/resmokelib/mongod_fuzzer_configs.py @@ -51,6 +51,11 @@ def generate_independent_parameters(rng): ret["wiredTigerSessionCloseIdleTimeSecs"] = rng.randint(0, 300) ret["wiredTigerConcurrentWriteTransactions"] = rng.randint(16, 256) ret["wiredTigerConcurrentReadTransactions"] = rng.randint(16, 256) + if rng.choice(3 * [True] + [False]): + # The old retryable writes format is used by other variants. Weight towards turning on the + # new retryable writes format on in this one. + ret["featureFlagRetryableFindAndModify"] = True + ret["storeFindAndModifyImagesInSideCollection"] = True return ret diff --git a/etc/backports_required_for_multiversion_tests.yml b/etc/backports_required_for_multiversion_tests.yml index aa4c327c15f..9c31285e273 100644 --- a/etc/backports_required_for_multiversion_tests.yml +++ b/etc/backports_required_for_multiversion_tests.yml @@ -144,6 +144,12 @@ all: test_file: jstests/concurrency/fsm_workloads/collmod_writeconflict.js - ticket: SERVER-55111 test_file: jstests/sharding/transactions_reject_writes_for_moved_chunks.js + - ticket: SERVER-59952 + test_file: jstests/sharding/write_transactions_during_migration.js + - ticket: SERVER-59952 + test_file: jstests/sharding/retryable_writes.js + - ticket: SERVER-59952 + test_file: jstests/sharding/move_chunk_find_and_modify_with_write_retryability.js # Tests that should only be excluded from particular suites should be listed under that suite. suites: diff --git a/jstests/multiVersion/retryable_write_update_oplog.js b/jstests/multiVersion/retryable_write_update_oplog.js index 082efb626cb..fe6c188ff91 100644 --- a/jstests/multiVersion/retryable_write_update_oplog.js +++ b/jstests/multiVersion/retryable_write_update_oplog.js @@ -148,7 +148,11 @@ function enableV2OplogEntries(rst) { assert.commandWorked(rst.getSecondary().adminCommand(cmd)); } -const rst = new ReplSetTest({nodes: 2, nodeOpts: {binVersion: "latest", noCleanData: true}}); +const rst = new ReplSetTest({ + nodes: 2, + nodeOpts: {binVersion: "latest", noCleanData: true}, + nodeOptions: {setParameter: {storeFindAndModifyImagesInSideCollection: false}} +}); jsTestLog("Running downgrade test"); diff --git a/jstests/replsets/libs/tenant_migration_test.js b/jstests/replsets/libs/tenant_migration_test.js index c6fff5bd8ba..1c729d3e1a2 100644 --- a/jstests/replsets/libs/tenant_migration_test.js +++ b/jstests/replsets/libs/tenant_migration_test.js @@ -115,6 +115,19 @@ function TenantMigrationTest({ // Stop any replica sets started by the TenantMigrationTest fixture. this.stop(); } + + function unsetStoreFindAndModifyImagesInSideCollection(rst) { + // Ensure `storeFindAndModifyImagesInSideCollection=false` to successfully run tenant + // migration. + const conn = rst.getPrimary(); + rst.asCluster(conn, () => { + return assert.commandWorked(conn.adminCommand( + {setParameter: 1, storeFindAndModifyImagesInSideCollection: false})); + }); + } + unsetStoreFindAndModifyImagesInSideCollection(this.getDonorRst()); + unsetStoreFindAndModifyImagesInSideCollection(this.getRecipientRst()); + return retVal; }; diff --git a/jstests/sharding/session_info_in_oplog.js b/jstests/sharding/session_info_in_oplog.js index a7644fca599..3ad935aa3b6 100644 --- a/jstests/sharding/session_info_in_oplog.js +++ b/jstests/sharding/session_info_in_oplog.js @@ -323,7 +323,12 @@ var runTests = function(mainConn, priConn, secConn) { lastTs = firstDoc.ts; }; -var replTest = new ReplSetTest({nodes: kNodes}); +// This test specifically looks for side-effects of writing retryable findAndModify images into the +// oplog as noops. Ensure images are not stored in a side collection. +var replTest = new ReplSetTest({ + nodes: kNodes, + nodeOptions: {setParameter: {storeFindAndModifyImagesInSideCollection: false}} +}); replTest.startSet(); replTest.initiate(); @@ -335,7 +340,9 @@ runTests(priConn, priConn, secConn); replTest.stopSet(); -var st = new ShardingTest({shards: {rs0: {nodes: kNodes}}}); +var st = new ShardingTest({ + shards: {rs0: {nodes: kNodes, setParameter: {storeFindAndModifyImagesInSideCollection: false}}} +}); secConn = st.rs0.getSecondary(); secConn.setSecondaryOk(); diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 963a5f587ee..f336f4b6b9f 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -2383,7 +2383,12 @@ var ReplSetTest = function(opts) { const dbHashes = rst.getHashes(dbName, secondaries); const primaryDBHash = dbHashes.primary; - const primaryCollections = Object.keys(primaryDBHash.collections); + // The `config.image_collection` is not necessarily consistent after an initial + // sync. It's guaranteed to be eventually consistent. However, tests that initial + // sync concurrently with retryable findAndModify statements cannot make this + // assumption. + const primaryCollections = Object.keys(primaryDBHash.collections) + .filter((x) => x !== "config.image_collection"); assert.commandWorked(primaryDBHash); // Filter only collections that were retrieved by the dbhash. listCollections diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index 68b4ce21251..966fc4a31f8 100644 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -694,6 +694,9 @@ MongoRunner.mongodOptions = function(opts = {}) { _removeSetParameterIfBeforeVersion( opts, "enableDefaultWriteConcernUpdatesForInitiate", "5.0.0"); _removeSetParameterIfBeforeVersion(opts, "enableReconfigRollbackCommittedWritesCheck", "5.0.0"); + // TODO SERVER-56952: Understand how to run a 5.0 with this setting against 4.4.x without + // allowing it on 4.9. + _removeSetParameterIfBeforeVersion(opts, "storeFindAndModifyImagesInSideCollection", "5.0.0"); if (!opts.logFile && opts.useLogFiles) { opts.logFile = opts.dbpath + "/mongod.log"; |