diff options
author | mathisbessamdb <mathis.bessa@mongodb.com> | 2022-05-09 13:19:28 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-09 14:18:38 +0000 |
commit | 464155c8c48ee56232ba12d8392697d070f33ba2 (patch) | |
tree | 8fff4cd95099d9095c2befdc1a61373a5857ff2b /jstests/serverless | |
parent | f7e9b07d14b42f237c454b3b4347d1419e85180c (diff) | |
download | mongo-464155c8c48ee56232ba12d8392697d070f33ba2.tar.gz |
SERVER-66269 fixing broken test that expects to run a second split
Diffstat (limited to 'jstests/serverless')
-rw-r--r-- | jstests/serverless/libs/basic_serverless_test.js | 37 | ||||
-rw-r--r-- | jstests/serverless/shard_split_rejects_multiple_ops.js | 3 |
2 files changed, 39 insertions, 1 deletions
diff --git a/jstests/serverless/libs/basic_serverless_test.js b/jstests/serverless/libs/basic_serverless_test.js index cffdcbb1d8c..cd1d0a5eb5a 100644 --- a/jstests/serverless/libs/basic_serverless_test.js +++ b/jstests/serverless/libs/basic_serverless_test.js @@ -312,6 +312,30 @@ class BasicServerlessTest { this.donor.ports.filter(port => !this.recipientNodes.some(node => node.port === port)); } + /** + * Remove the recipient nodes from the donor's config memberset and calls replSetReconfig on the + * updated local config. + */ + reconfigDonorSetAfterSplit() { + // TODO(SERVER-65730) we no longer will need to call this method explicitly in the test as + // it will be part of the commit shard split process. + const primary = this.donor.getPrimary(); + const config = this.donor.getReplSetConfigFromNode(); + config.version++; + + let donorNodeHosts = []; + this.donor.nodes.forEach(node => { + donorNodeHosts.push("" + node.host); + }); + + // remove recipient nodes and config. + config.members = + config.members.filter(member => donorNodeHosts.some(node => node === member.host)); + delete config.recipientConfig; + + assert.commandWorked(primary.adminCommand({replSetReconfig: config})); + } + /* * Look up tenant access blockers for the given tenant ids and will check, based upon the * expected state the access blockers are expected to be, that the different fields are @@ -344,6 +368,19 @@ class BasicServerlessTest { tenantAccessBlockersAbortTimestamp; })); } + + /** + * After calling the forgetShardSplit command, wait for the tenant access blockers to be removed + * then remove and stop the recipient nodes from the donor set and test and finally apply the + * new config once the split has been cleaned up. + * @param {migrationId} migration id of the committed shard split operation. + * @param {tenantIds} tenant IDs that were used for the split operation. + */ + cleanupSuccesfulAbortedOrCommitted(migrationId, tenantIds) { + this.waitForGarbageCollection(migrationId, tenantIds); + this.removeAndStopRecipientNodes(); + this.reconfigDonorSetAfterSplit(); + } } BasicServerlessTest.kConfigSplitDonorsNS = "config.tenantSplitDonors"; diff --git a/jstests/serverless/shard_split_rejects_multiple_ops.js b/jstests/serverless/shard_split_rejects_multiple_ops.js index 35099bf0633..2c1106948ec 100644 --- a/jstests/serverless/shard_split_rejects_multiple_ops.js +++ b/jstests/serverless/shard_split_rejects_multiple_ops.js @@ -83,9 +83,10 @@ function commitShardSplitConcurrently() { }), 117); // ConflictingOperationInProgress - test.waitForGarbageCollection(migrationId, tenantIds); + test.cleanupSuccesfulAbortedOrCommitted(migrationId, tenantIds); // another split operation can start after garbage collection of the previous one. + test.addRecipientNodes(); assert.commandWorked(donorPrimary.adminCommand({ commitShardSplit: 1, migrationId: UUID(), |