summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zhang <jason.zhang@mongodb.com>2021-07-15 03:51:28 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-23 15:07:37 +0000
commit785c2ed58a5e98335faf37b14cef0bbce5832ee2 (patch)
tree230e95c8083306c55bf861c24c63e6f440e29aac
parentfccf8ac6de56efaadea73a659b8b5ada12844a04 (diff)
downloadmongo-r5.1.0-alpha.tar.gz
SERVER-58480 Add the necessary parameters to the ContinuousTenantMigration hook to allow for proper transient error retryr5.1.0-alpha
-rw-r--r--buildscripts/resmokeconfig/suites/tenant_migration_kill_primary_jscore_passthrough.yml7
-rw-r--r--buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml7
-rw-r--r--buildscripts/resmokeconfig/suites/tenant_migration_terminate_primary_jscore_passthrough.yml7
-rw-r--r--jstests/hooks/run_check_tenant_migration_dbhash.js5
-rw-r--r--jstests/replsets/libs/tenant_migration_util.js55
5 files changed, 34 insertions, 47 deletions
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 3b00933e879..7b25c30cc6c 100644
--- a/buildscripts/resmokeconfig/suites/tenant_migration_kill_primary_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/tenant_migration_kill_primary_jscore_passthrough.yml
@@ -263,10 +263,17 @@ executor:
auth_options: *authOptions
- class: ContinuousTenantMigration
shell_options:
+ eval: >-
+ testingReplication = true;
+ load('jstests/libs/override_methods/network_error_and_txn_override.js');
+ load("jstests/libs/override_methods/set_read_and_write_concerns.js");
global_vars:
TestData:
<<: *TestData
authOptions: *authOptions
+ # We specify nodb so the shell used by each test will attempt to connect after loading the
+ # retry logic in auto_retry_on_network_error.js.
+ nodb: ""
# The CheckReplDBHash hook waits until all operations have replicated to and have been applied
# on the secondaries, so we run the ValidateCollections hook after it to ensure we're
# validating the entire contents of the collection.
diff --git a/buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml
index be354b863c4..fb659ccb2b8 100644
--- a/buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/tenant_migration_stepdown_jscore_passthrough.yml
@@ -252,10 +252,17 @@ executor:
auth_options: *authOptions
- class: ContinuousTenantMigration
shell_options:
+ eval: >-
+ testingReplication = true;
+ load('jstests/libs/override_methods/network_error_and_txn_override.js');
+ load("jstests/libs/override_methods/set_read_and_write_concerns.js");
global_vars:
TestData:
<<: *TestData
authOptions: *authOptions
+ # We specify nodb so the shell used by each test will attempt to connect after loading the
+ # retry logic in auto_retry_on_network_error.js.
+ nodb: ""
# The CheckReplDBHash hook waits until all operations have replicated to and have been applied
# on the secondaries, so we run the ValidateCollections hook after it to ensure we're
# validating the entire contents of the collection.
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 dc26c216799..5defd9989e1 100644
--- a/buildscripts/resmokeconfig/suites/tenant_migration_terminate_primary_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/tenant_migration_terminate_primary_jscore_passthrough.yml
@@ -253,10 +253,17 @@ executor:
auth_options: *authOptions
- class: ContinuousTenantMigration
shell_options:
+ eval: >-
+ testingReplication = true;
+ load('jstests/libs/override_methods/network_error_and_txn_override.js');
+ load("jstests/libs/override_methods/set_read_and_write_concerns.js");
global_vars:
TestData:
<<: *TestData
authOptions: *authOptions
+ # We specify nodb so the shell used by each test will attempt to connect after loading the
+ # retry logic in auto_retry_on_network_error.js.
+ nodb: ""
# The CheckReplDBHash hook waits until all operations have replicated to and have been applied
# on the secondaries, so we run the ValidateCollections hook after it to ensure we're
# validating the entire contents of the collection.
diff --git a/jstests/hooks/run_check_tenant_migration_dbhash.js b/jstests/hooks/run_check_tenant_migration_dbhash.js
index 779ab9d1795..c75b98aa38b 100644
--- a/jstests/hooks/run_check_tenant_migration_dbhash.js
+++ b/jstests/hooks/run_check_tenant_migration_dbhash.js
@@ -10,8 +10,6 @@ const testDBName = "testTenantMigration";
const dbhashCollName = "dbhashCheck";
const tenantId = TestData.tenantId;
const migrationId = UUID(TestData.migrationIdString);
-const retryOnNetworkErrors = TestData.networkErrorAndTxnOverrideConfig &&
- TestData.networkErrorAndTxnOverrideConfig.retryOnNetworkErrors;
let donorRst;
let recipientRst;
@@ -36,8 +34,7 @@ while (true) {
}
// We assume every db is under the tenant being migrated.
-TenantMigrationUtil.checkTenantDBHashes(
- donorRst, recipientRst, tenantId, excludedDBs, retryOnNetworkErrors);
+TenantMigrationUtil.checkTenantDBHashes(donorRst, recipientRst, tenantId, excludedDBs);
// Mark that we have completed the dbhash check.
assert.commandWorked(donorDB.runCommand(
diff --git a/jstests/replsets/libs/tenant_migration_util.js b/jstests/replsets/libs/tenant_migration_util.js
index 3d1a62bbd80..0b96bb04b7e 100644
--- a/jstests/replsets/libs/tenant_migration_util.js
+++ b/jstests/replsets/libs/tenant_migration_util.js
@@ -276,7 +276,6 @@ var TenantMigrationUtil = (function() {
recipientRst,
tenantId,
excludedDBs = [],
- retryOnRetryableErrors = false,
msgPrefix = 'checkTenantDBHashes',
ignoreUUIDs = false) {
// Always skip db hash checks for the config, admin, and local database.
@@ -284,28 +283,8 @@ var TenantMigrationUtil = (function() {
while (true) {
try {
- // If a cluster has authentication enabled, then we would need to also log in as
- // users with the proper roles for each session client as well. Since authentication
- // is only relevant in certain jstests, we can split the code path such that we only
- // run within a session if we set the retryOnRetryableErrors flag to be true.
- let donorPrimaryConn;
- let recipientPrimaryConn;
- let donorSession;
- let recipientSession;
-
- // In failover suites we want to run within a session to allow for retryable
- // operations to retry.
- if (retryOnRetryableErrors) {
- donorSession =
- new Mongo(donorRst.getPrimary().host).startSession({retryWrites: true});
- recipientSession =
- new Mongo(recipientRst.getPrimary().host).startSession({retryWrites: true});
- donorPrimaryConn = donorSession.getClient();
- recipientPrimaryConn = recipientSession.getClient();
- } else {
- donorPrimaryConn = donorRst.getPrimary();
- recipientPrimaryConn = recipientRst.getPrimary();
- }
+ const donorPrimaryConn = donorRst.getPrimary();
+ const recipientPrimaryConn = recipientRst.getPrimary();
// Allows listCollections and listIndexes on donor after migration for consistency
// checks.
@@ -333,25 +312,12 @@ var TenantMigrationUtil = (function() {
combinedDBNames = new Set(combinedDBNames);
for (const dbName of combinedDBNames) {
- let donorDBHash;
- let recipientDBHash;
-
- // If a failover occurs while we run getHashes(), it is possible that the
- // self._primary referenced in a ReplSetTest is currently undefined which will
- // cause issues when it tries to get a session from an undefined variable. Thus,
- // we use the underlying helper function getHashesUsingSessions() and pass in
- // the donor and recipient connection sessions manually to circumvent the issue.
- if (retryOnRetryableErrors) {
- donorDBHash = donorRst.getHashesUsingSessions([donorSession], dbName)[0];
- recipientDBHash =
- recipientRst.getHashesUsingSessions([recipientSession], dbName)[0];
- } else {
- // Pass in an empty array for the secondaries, since we only wish to compare
- // the DB hashes between the donor and recipient primary in this test.
- donorDBHash = assert.commandWorked(donorRst.getHashes(dbName, []).primary);
- recipientDBHash =
- assert.commandWorked(recipientRst.getHashes(dbName, []).primary);
- }
+ // Pass in an empty array for the secondaries, since we only wish to compare
+ // the DB hashes between the donor and recipient primary in this test.
+ const donorDBHash =
+ assert.commandWorked(donorRst.getHashes(dbName, []).primary);
+ const recipientDBHash =
+ assert.commandWorked(recipientRst.getHashes(dbName, []).primary);
const donorCollections = Object.keys(donorDBHash.collections);
const donorCollInfos = new CollInfos(donorPrimaryConn, 'donorPrimary', dbName);
@@ -438,7 +404,10 @@ var TenantMigrationUtil = (function() {
"can't connect to new replica set primary"
];
- return isRetryableError(error) || isNetworkError(error) ||
+ return ErrorCodes.isRetriableError(error.code) || ErrorCodes.isNetworkError(error.code) ||
+ // The following shell helper methods check if the error message contains some
+ // notion of retriability. This is in case the error does not contain an error code.
+ isRetryableError(error) || isNetworkError(error) ||
// If there's a failover while we're running a dbhash check, the elected secondary might
// not have set the tenantMigrationDonorAllowsNonTimestampedReads failpoint, which means
// that the listCollections command run when we call CollInfos would throw a