summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/replsets/libs/tenant_migration_test.js9
-rw-r--r--jstests/replsets/tenant_migration_cloner_stats_with_failover.js3
-rw-r--r--jstests/replsets/tenant_migration_donor_retry.js1
-rw-r--r--jstests/replsets/tenant_migration_donor_try_abort.js19
-rw-r--r--jstests/replsets/tenant_migration_recipient_aborts_merge_on_donor_failure.js4
-rw-r--r--jstests/replsets/tenant_migration_recipient_current_op.js36
-rw-r--r--jstests/replsets/tenant_migration_recipient_failover_before_creating_oplog_buffer.js3
-rw-r--r--jstests/replsets/tenant_migration_recipient_initial_sync_cloning.js1
-rw-r--r--jstests/replsets/tenant_migration_recipient_initial_sync_recovery.js1
-rw-r--r--jstests/replsets/tenant_migration_recipient_retryable_writes_failover.js1
-rw-r--r--jstests/replsets/tenant_migration_recipient_rollback_recovery.js1
-rw-r--r--jstests/replsets/tenant_migration_recipient_shard_merge.js72
-rw-r--r--jstests/replsets/tenant_migration_recipient_startup_recovery.js1
-rw-r--r--jstests/replsets/tenant_migration_recipient_sync_donor_timestamp.js1
-rw-r--r--jstests/replsets/tenant_migration_recipient_sync_source_reconnect_delayed_secondary.js1
-rw-r--r--jstests/replsets/tenant_migration_recipient_sync_source_restart_donor_secondary.js1
-rw-r--r--jstests/replsets/tenant_migration_resume_collection_cloner_after_recipient_failover.js1
-rw-r--r--jstests/replsets/tenant_migration_resume_collection_cloner_after_rename.js1
-rw-r--r--jstests/replsets/tenant_migration_resume_oplog_application.js1
19 files changed, 139 insertions, 19 deletions
diff --git a/jstests/replsets/libs/tenant_migration_test.js b/jstests/replsets/libs/tenant_migration_test.js
index 9cbb7523559..0e70ca11dbc 100644
--- a/jstests/replsets/libs/tenant_migration_test.js
+++ b/jstests/replsets/libs/tenant_migration_test.js
@@ -594,11 +594,20 @@ TenantMigrationTest.DonorState = {
};
TenantMigrationTest.RecipientState = {
+ kUninitialized: "uninitialized",
kStarted: "started",
kConsistent: "consistent",
kDone: "done",
+ kLearnedFilenames: "learned filenames",
+ kCopiedFiles: "copied files",
};
+TenantMigrationTest.RecipientStateEnum =
+ Object.keys(TenantMigrationTest.RecipientState).reduce((acc, key, idx) => {
+ acc[key] = idx;
+ return acc;
+ }, {});
+
TenantMigrationTest.State = TenantMigrationTest.DonorState;
TenantMigrationTest.DonorAccessState = {
diff --git a/jstests/replsets/tenant_migration_cloner_stats_with_failover.js b/jstests/replsets/tenant_migration_cloner_stats_with_failover.js
index 6b7235ae54d..0f6fe130bf9 100644
--- a/jstests/replsets/tenant_migration_cloner_stats_with_failover.js
+++ b/jstests/replsets/tenant_migration_cloner_stats_with_failover.js
@@ -13,6 +13,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
@@ -146,4 +147,4 @@ assert.eq(currOp.databases.databasesClonedBeforeFailover, 1, res);
assert.eq(currOp.databases[dbName2].clonedCollectionsBeforeFailover, 1, res);
tenantMigrationTest.stop();
-})(); \ No newline at end of file
+})();
diff --git a/jstests/replsets/tenant_migration_donor_retry.js b/jstests/replsets/tenant_migration_donor_retry.js
index 1fb1a36c526..28dfb5692a0 100644
--- a/jstests/replsets/tenant_migration_donor_retry.js
+++ b/jstests/replsets/tenant_migration_donor_retry.js
@@ -5,6 +5,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_donor_try_abort.js b/jstests/replsets/tenant_migration_donor_try_abort.js
index 3d6ada6316c..2f4ba6b64d2 100644
--- a/jstests/replsets/tenant_migration_donor_try_abort.js
+++ b/jstests/replsets/tenant_migration_donor_try_abort.js
@@ -79,9 +79,15 @@ const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest();
jsTestLog(
"Test sending donorAbortMigration during a tenant migration while recipientSyncData " +
"command repeatedly fails with retryable errors.");
-
const tenantMigrationTest = new TenantMigrationTest({name: jsTestName()});
+ if (TenantMigrationUtil.isShardMergeEnabled(
+ tenantMigrationTest.getDonorPrimary().getDB("admin"))) {
+ tenantMigrationTest.stop();
+ jsTestLog("Skipping test, Shard Merge does not support retry");
+ return;
+ }
+
const recipientPrimary = tenantMigrationTest.getRecipientPrimary();
let fp = configureFailPoint(recipientPrimary, "failCommand", {
failInternalCommands: true,
@@ -114,9 +120,15 @@ const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest();
(() => {
jsTestLog("Test sending donorAbortMigration during a tenant migration while find command " +
"against admin.system.keys repeatedly fails with retryable errors.");
-
const tenantMigrationTest = new TenantMigrationTest({name: jsTestName()});
+ if (TenantMigrationUtil.isShardMergeEnabled(
+ tenantMigrationTest.getDonorPrimary().getDB("admin"))) {
+ tenantMigrationTest.stop();
+ jsTestLog("Skipping test, Shard Merge does not support retry");
+ return;
+ }
+
const recipientPrimary = tenantMigrationTest.getRecipientPrimary();
let fp = configureFailPoint(recipientPrimary, "failCommand", {
failInternalCommands: true,
@@ -521,6 +533,9 @@ const migrationX509Options = TenantMigrationUtil.makeX509OptionsForTest();
assert(findRes);
});
+ TenantMigrationTest.assertCommitted(
+ tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
+
tenantMigrationTest.stop();
donorRst.stopSet();
})();
diff --git a/jstests/replsets/tenant_migration_recipient_aborts_merge_on_donor_failure.js b/jstests/replsets/tenant_migration_recipient_aborts_merge_on_donor_failure.js
index 2408162a2b2..51615707003 100644
--- a/jstests/replsets/tenant_migration_recipient_aborts_merge_on_donor_failure.js
+++ b/jstests/replsets/tenant_migration_recipient_aborts_merge_on_donor_failure.js
@@ -26,6 +26,7 @@ load("jstests/replsets/libs/tenant_migration_util.js");
if (!TenantMigrationUtil.isShardMergeEnabled(recipientPrimary.getDB("admin"))) {
tenantMigrationTest.stop();
+ jsTestLog("Skipping Shard Merge-specific test");
return;
}
@@ -56,11 +57,12 @@ load("jstests/replsets/libs/tenant_migration_util.js");
waitInFailPoint.wait();
jsTestLog("Stopping the donor primary");
donorRst.stop(donorPrimary);
- waitInFailPoint.off();
// wait until the completion path has started after the abort
const hangBeforeTaskCompletion =
configureFailPoint(recipientPrimary, "hangBeforeTaskCompletion", {action: "hang"});
+
+ waitInFailPoint.off();
hangBeforeTaskCompletion.wait();
// step up a secondary so that the migration will complete and the
diff --git a/jstests/replsets/tenant_migration_recipient_current_op.js b/jstests/replsets/tenant_migration_recipient_current_op.js
index 975aa1fc8ea..378bbd2400d 100644
--- a/jstests/replsets/tenant_migration_recipient_current_op.js
+++ b/jstests/replsets/tenant_migration_recipient_current_op.js
@@ -25,13 +25,6 @@ load("jstests/replsets/libs/tenant_migration_util.js");
const tenantMigrationTest = new TenantMigrationTest({name: jsTestName()});
-// An object that mirrors the recipient migration states.
-const migrationStates = {
- kStarted: 1,
- kConsistent: 2,
- kDone: 3
-};
-
const kMigrationId = UUID();
const kTenantId = 'testTenantId';
const kReadPreference = {
@@ -45,6 +38,9 @@ const migrationOpts = {
const recipientPrimary = tenantMigrationTest.getRecipientPrimary();
+const shardMergeIsEnabled =
+ TenantMigrationUtil.isShardMergeEnabled(recipientPrimary.getDB("admin"));
+
// Initial inserts to test cloner stats.
const dbsToClone = ["db0", "db1", "db2"];
const collsToClone = ["coll0", "coll1"];
@@ -134,7 +130,7 @@ fpAfterPersistingStateDoc.wait();
let res = recipientPrimary.adminCommand({currentOp: true, desc: "tenant recipient migration"});
checkStandardFieldsOK(res);
let currOp = res.inprog[0];
-assert.eq(currOp.state, migrationStates.kStarted, res);
+assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kStarted, res);
assert.eq(currOp.migrationCompleted, false, res);
assert.eq(currOp.dataSyncCompleted, false, res);
assert(!currOp.hasOwnProperty("startFetchingDonorOpTime"), res);
@@ -157,7 +153,13 @@ res = recipientPrimary.adminCommand({currentOp: true, desc: "tenant recipient mi
checkStandardFieldsOK(res);
currOp = res.inprog[0];
assert.gt(new Date(), currOp.receiveStart, tojson(res));
-assert.eq(currOp.state, migrationStates.kStarted, res);
+
+if (shardMergeIsEnabled) {
+ assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kLearnedFilenames, res);
+} else {
+ assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kStarted, res);
+}
+
assert.eq(currOp.migrationCompleted, false, res);
assert.eq(currOp.dataSyncCompleted, false, res);
assert(!currOp.hasOwnProperty("dataConsistentStopDonorOpTime"), res);
@@ -185,7 +187,13 @@ fpAfterCollectionCloner.wait();
res = recipientPrimary.adminCommand({currentOp: true, desc: "tenant recipient migration"});
checkStandardFieldsOK(res);
currOp = res.inprog[0];
-assert.eq(currOp.state, migrationStates.kStarted, res);
+
+if (shardMergeIsEnabled) {
+ assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kLearnedFilenames, res);
+} else {
+ assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kStarted, res);
+}
+
assert.eq(currOp.migrationCompleted, false, res);
assert.eq(currOp.dataSyncCompleted, false, res);
assert(!currOp.hasOwnProperty("expireAt"), res);
@@ -228,7 +236,7 @@ checkStandardFieldsOK(res);
checkPostConsistentFieldsOK(res);
currOp = res.inprog[0];
// State should have changed.
-assert.eq(currOp.state, migrationStates.kConsistent, res);
+assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kConsistent, res);
assert.eq(currOp.migrationCompleted, false, res);
assert.eq(currOp.dataSyncCompleted, false, res);
assert(!currOp.hasOwnProperty("expireAt"), res);
@@ -242,7 +250,7 @@ checkStandardFieldsOK(res);
checkPostConsistentFieldsOK(res);
currOp = res.inprog[0];
// State should have changed.
-assert.eq(currOp.state, migrationStates.kConsistent, res);
+assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kConsistent, res);
assert.eq(currOp.migrationCompleted, false, res);
assert.eq(currOp.dataSyncCompleted, false, res);
assert(!currOp.hasOwnProperty("expireAt"), res);
@@ -268,7 +276,7 @@ res = recipientPrimary.adminCommand({currentOp: true, desc: "tenant recipient mi
checkStandardFieldsOK(res);
checkPostConsistentFieldsOK(res);
currOp = res.inprog[0];
-assert.eq(currOp.state, migrationStates.kConsistent, res);
+assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kConsistent, res);
assert.eq(currOp.migrationCompleted, false, res);
// dataSyncCompleted should have changed.
assert.eq(currOp.dataSyncCompleted, true, res);
@@ -284,7 +292,7 @@ checkPostConsistentFieldsOK(res);
currOp = res.inprog[0];
assert.eq(currOp.dataSyncCompleted, true, res);
// State, completion status and expireAt should have changed.
-assert.eq(currOp.state, migrationStates.kDone, res);
+assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kDone, res);
assert.eq(currOp.migrationCompleted, true, res);
assert(currOp.hasOwnProperty("expireAt") && currOp.expireAt instanceof Date, res);
assert(currOp.hasOwnProperty("databases"));
diff --git a/jstests/replsets/tenant_migration_recipient_failover_before_creating_oplog_buffer.js b/jstests/replsets/tenant_migration_recipient_failover_before_creating_oplog_buffer.js
index 3a1b29998e7..76662d80993 100644
--- a/jstests/replsets/tenant_migration_recipient_failover_before_creating_oplog_buffer.js
+++ b/jstests/replsets/tenant_migration_recipient_failover_before_creating_oplog_buffer.js
@@ -5,6 +5,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_persistence,
* requires_replication,
@@ -55,4 +56,4 @@ jsTestLog("Waiting for migration to complete.");
TenantMigrationTest.assertCommitted(tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
tenantMigrationTest.stop();
-})(); \ No newline at end of file
+})();
diff --git a/jstests/replsets/tenant_migration_recipient_initial_sync_cloning.js b/jstests/replsets/tenant_migration_recipient_initial_sync_cloning.js
index 710d20f200d..4afde043e12 100644
--- a/jstests/replsets/tenant_migration_recipient_initial_sync_cloning.js
+++ b/jstests/replsets/tenant_migration_recipient_initial_sync_cloning.js
@@ -6,6 +6,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_recipient_initial_sync_recovery.js b/jstests/replsets/tenant_migration_recipient_initial_sync_recovery.js
index 9d792cdbf8c..9337fe5999f 100644
--- a/jstests/replsets/tenant_migration_recipient_initial_sync_recovery.js
+++ b/jstests/replsets/tenant_migration_recipient_initial_sync_recovery.js
@@ -7,6 +7,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_recipient_retryable_writes_failover.js b/jstests/replsets/tenant_migration_recipient_retryable_writes_failover.js
index 3fc35f5d772..02f6b4ddab1 100644
--- a/jstests/replsets/tenant_migration_recipient_retryable_writes_failover.js
+++ b/jstests/replsets/tenant_migration_recipient_retryable_writes_failover.js
@@ -5,6 +5,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_recipient_rollback_recovery.js b/jstests/replsets/tenant_migration_recipient_rollback_recovery.js
index 0f694c40912..f57c9c68d56 100644
--- a/jstests/replsets/tenant_migration_recipient_rollback_recovery.js
+++ b/jstests/replsets/tenant_migration_recipient_rollback_recovery.js
@@ -4,6 +4,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_recipient_shard_merge.js b/jstests/replsets/tenant_migration_recipient_shard_merge.js
new file mode 100644
index 00000000000..36f20529d03
--- /dev/null
+++ b/jstests/replsets/tenant_migration_recipient_shard_merge.js
@@ -0,0 +1,72 @@
+/**
+ * Tests recipient behavior for shard merge
+ *
+ * @tags: [
+ * incompatible_with_eft,
+ * incompatible_with_macos,
+ * incompatible_with_windows_tls,
+ * requires_majority_read_concern,
+ * requires_persistence,
+ * ]
+ */
+
+(function() {
+"use strict";
+
+load("jstests/libs/fail_point_util.js");
+load("jstests/libs/uuid_util.js");
+load("jstests/replsets/libs/tenant_migration_test.js");
+load("jstests/replsets/libs/tenant_migration_util.js");
+
+(() => {
+ const tenantMigrationTest =
+ new TenantMigrationTest({name: jsTestName(), sharedOptions: {nodes: 3}});
+
+ const recipientPrimary = tenantMigrationTest.getRecipientPrimary();
+
+ if (!TenantMigrationUtil.isShardMergeEnabled(recipientPrimary.getDB("admin"))) {
+ tenantMigrationTest.stop();
+ jsTestLog("Skipping Shard Merge-specific test");
+ return;
+ }
+
+ jsTestLog(
+ "Test that recipient state is correctly set to 'learned filenames' after creating the backup cursor");
+ const tenantId = "testTenantId";
+ const tenantDB = tenantMigrationTest.tenantDB(tenantId, "DB");
+ const collName = "testColl";
+
+ const donorRst = tenantMigrationTest.getDonorRst();
+ const donorPrimary = tenantMigrationTest.getDonorPrimary();
+ const donorSecondary = donorRst.getSecondary();
+
+ tenantMigrationTest.insertDonorDB(tenantDB, collName);
+
+ const failpoint = "fpAfterRetrievingStartOpTimesMigrationRecipientInstance";
+ const waitInFailPoint = configureFailPoint(recipientPrimary, failpoint, {action: "hang"});
+
+ const migrationUuid = UUID();
+ const migrationOpts = {
+ migrationIdString: extractUUIDFromObject(migrationUuid),
+ tenantId,
+ readPreference: {mode: 'primary'}
+ };
+
+ jsTestLog(`Starting the tenant migration to wait in failpoint: ${failpoint}`);
+ assert.commandWorked(tenantMigrationTest.startMigration(migrationOpts));
+
+ waitInFailPoint.wait();
+
+ const res =
+ recipientPrimary.adminCommand({currentOp: true, desc: "tenant recipient migration"});
+ assert.eq(res.inprog.length, 1);
+ const [currOp] = res.inprog;
+ assert.eq(currOp.state, TenantMigrationTest.RecipientStateEnum.kLearnedFilenames, res);
+ waitInFailPoint.off();
+
+ TenantMigrationTest.assertCommitted(
+ tenantMigrationTest.waitForMigrationToComplete(migrationOpts));
+
+ tenantMigrationTest.stop();
+})();
+})();
diff --git a/jstests/replsets/tenant_migration_recipient_startup_recovery.js b/jstests/replsets/tenant_migration_recipient_startup_recovery.js
index 553cfb0b91f..d73dd0c975e 100644
--- a/jstests/replsets/tenant_migration_recipient_startup_recovery.js
+++ b/jstests/replsets/tenant_migration_recipient_startup_recovery.js
@@ -7,6 +7,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_recipient_sync_donor_timestamp.js b/jstests/replsets/tenant_migration_recipient_sync_donor_timestamp.js
index 97684dc8a07..26eb2e7fd87 100644
--- a/jstests/replsets/tenant_migration_recipient_sync_donor_timestamp.js
+++ b/jstests/replsets/tenant_migration_recipient_sync_donor_timestamp.js
@@ -7,6 +7,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_persistence,
* requires_replication,
diff --git a/jstests/replsets/tenant_migration_recipient_sync_source_reconnect_delayed_secondary.js b/jstests/replsets/tenant_migration_recipient_sync_source_reconnect_delayed_secondary.js
index 7fd34589f07..9d3c3a35f4b 100644
--- a/jstests/replsets/tenant_migration_recipient_sync_source_reconnect_delayed_secondary.js
+++ b/jstests/replsets/tenant_migration_recipient_sync_source_reconnect_delayed_secondary.js
@@ -10,6 +10,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_recipient_sync_source_restart_donor_secondary.js b/jstests/replsets/tenant_migration_recipient_sync_source_restart_donor_secondary.js
index 8cf2c415337..c36cb71e67b 100644
--- a/jstests/replsets/tenant_migration_recipient_sync_source_restart_donor_secondary.js
+++ b/jstests/replsets/tenant_migration_recipient_sync_source_restart_donor_secondary.js
@@ -9,6 +9,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_resume_collection_cloner_after_recipient_failover.js b/jstests/replsets/tenant_migration_resume_collection_cloner_after_recipient_failover.js
index 62d51b1258a..bd6feb7e8e5 100644
--- a/jstests/replsets/tenant_migration_resume_collection_cloner_after_recipient_failover.js
+++ b/jstests/replsets/tenant_migration_resume_collection_cloner_after_recipient_failover.js
@@ -4,6 +4,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_resume_collection_cloner_after_rename.js b/jstests/replsets/tenant_migration_resume_collection_cloner_after_rename.js
index e50e9c48c40..e3a2b36a612 100644
--- a/jstests/replsets/tenant_migration_resume_collection_cloner_after_rename.js
+++ b/jstests/replsets/tenant_migration_resume_collection_cloner_after_rename.js
@@ -4,6 +4,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,
diff --git a/jstests/replsets/tenant_migration_resume_oplog_application.js b/jstests/replsets/tenant_migration_resume_oplog_application.js
index da857c9cd70..207be5f0968 100644
--- a/jstests/replsets/tenant_migration_resume_oplog_application.js
+++ b/jstests/replsets/tenant_migration_resume_oplog_application.js
@@ -4,6 +4,7 @@
* @tags: [
* incompatible_with_eft,
* incompatible_with_macos,
+ * incompatible_with_shard_merge,
* incompatible_with_windows_tls,
* requires_majority_read_concern,
* requires_persistence,