SERVER-57089 Add skip_dbhash flag to ContinuousTenantMigration

This commit is contained in:
Pavi Vetriselvan
2021-05-20 18:34:00 -04:00
committed by Evergreen Agent
parent de1fa17826
commit fffcdd7eba
5 changed files with 23 additions and 13 deletions

View File

@@ -253,6 +253,7 @@ executor:
readPreference:
mode: "primary"
retryWrites: true
skipTenantMigrationDBHash: false
# 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: ""

View File

@@ -249,6 +249,7 @@ executor:
readPreference:
mode: "primary"
retryWrites: true
skipTenantMigrationDBHash: false
# 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: ""

View File

@@ -249,6 +249,7 @@ executor:
readPreference:
mode: "primary"
retryWrites: true
skipTenantMigrationDBHash: false
# 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: ""

View File

@@ -242,6 +242,10 @@ class _TenantMigrationThread(threading.Thread): # pylint: disable=too-many-inst
self._auth_options = shell_options["global_vars"]["TestData"]["authOptions"]
self._test_report = test_report
self._shell_options = shell_options
self._skip_dbhash = False
if "skipTenantMigrationDBHash" in self._shell_options["global_vars"]["TestData"]:
self._skip_dbhash = self._shell_options["global_vars"]["TestData"][
"skipTenantMigrationDBHash"]
self.__lifecycle = TenantMigrationLifeCycle()
# Event set when the thread has been stopped using the 'stop()' method.
@@ -411,7 +415,8 @@ class _TenantMigrationThread(threading.Thread): # pylint: disable=too-many-inst
# in the next test.
if is_committed:
# Once we have committed a migration, run a dbhash check before rerouting commands.
self._check_tenant_migration_dbhash(migration_opts)
if not self._skip_dbhash:
self._check_tenant_migration_dbhash(migration_opts)
# If the migration committed, to avoid routing commands incorrectly, wait for the
# donor/proxy to reroute at least one command before doing garbage collection. Stop

View File

@@ -516,19 +516,21 @@ Mongo.prototype.runCommandRetryOnTenantMigrationErrors = function(
// After getting a TenantMigrationCommitted error, wait for the python test fixture
// to do a dbhash check on the donor and recipient primaries before we retry the
// command on the recipient.
assert.soon(() => {
let findRes = assert.commandWorked(originalRunCommand.apply(this, [
"testTenantMigration",
{
find: "dbhashCheck",
filter: {_id: this.migrationStateDoc._id},
},
0
]));
if (!TestData.skipTenantMigrationDBHash) {
assert.soon(() => {
let findRes = assert.commandWorked(originalRunCommand.apply(this, [
"testTenantMigration",
{
find: "dbhashCheck",
filter: {_id: this.migrationStateDoc._id},
},
0
]));
const docs = findRes.cursor.firstBatch;
return docs[0] != null;
});
const docs = findRes.cursor.firstBatch;
return docs[0] != null;
});
}
} else if (migrationAbortedErr) {
jsTestLog(`Got TenantMigrationAborted for command against database ${
dbNameWithTenantId} after trying ${numAttempts} times: ${tojson(resObj)}`);