summaryrefslogtreecommitdiff
path: root/jstests/multiVersion
diff options
context:
space:
mode:
authorAbdul Qadeer <abdul.qadeer@mongodb.com>2022-07-18 11:36:54 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-05 20:28:39 +0000
commit32f1d5772af14cecc6df7d06eed6e850aa39d0ee (patch)
tree0b2c74fd001d6347abdb5d2b31a346494fcbd0bb /jstests/multiVersion
parent32f0f9c88dc44a2c8073a5bd47cf779d4bfdee6b (diff)
downloadmongo-32f1d5772af14cecc6df7d06eed6e850aa39d0ee.tar.gz
SERVER-61985 SERVER-67193 Make reshardingPauseCoordinatorBeforeCompletion failpoint pause conditionally
(cherry picked from commit 0d5fd57f9e55915550dd7d13340e2944c169c6e2)
Diffstat (limited to 'jstests/multiVersion')
-rw-r--r--jstests/multiVersion/genericSetFCVUsage/setfcv_aborts_reshard_collection.js (renamed from jstests/multiVersion/genericSetFCVUsage/setfcv_reshard_collection.js)33
1 files changed, 29 insertions, 4 deletions
diff --git a/jstests/multiVersion/genericSetFCVUsage/setfcv_reshard_collection.js b/jstests/multiVersion/genericSetFCVUsage/setfcv_aborts_reshard_collection.js
index 7fa818f7f99..82d7d62b8f7 100644
--- a/jstests/multiVersion/genericSetFCVUsage/setfcv_reshard_collection.js
+++ b/jstests/multiVersion/genericSetFCVUsage/setfcv_aborts_reshard_collection.js
@@ -1,6 +1,10 @@
+/**
+ * Tests that setFeatureCompatibilityVersion command aborts an ongoing reshardCollection command
+ */
(function() {
"use strict";
+load("jstests/libs/parallel_shell_helpers.js");
load("jstests/sharding/libs/resharding_test_fixture.js");
load('jstests/libs/discover_topology.js');
load('jstests/libs/fail_point_util.js');
@@ -21,6 +25,8 @@ function runTest(forcePooledConnectionsDropped) {
],
});
+ const sourceNamespace = inputCollection.getFullName();
+
let mongos = inputCollection.getMongo();
for (let x = 0; x < 1000; x++) {
@@ -37,7 +43,17 @@ function runTest(forcePooledConnectionsDropped) {
pauseBeforeCloseCxns = configureFailPoint(config, "pauseBeforeCloseCxns");
}
+ function checkCoordinatorDoc() {
+ assert.soon(() => {
+ const coordinatorDoc =
+ mongos.getCollection("config.reshardingOperations").findOne({ns: sourceNamespace});
+
+ return coordinatorDoc === null || coordinatorDoc.state === "aborting";
+ });
+ }
+
const recipientShardNames = reshardingTest.recipientShardNames;
+ let awaitShell;
reshardingTest.withReshardingInBackground(
{
newShardKeyPattern: {newKey: 1},
@@ -63,7 +79,7 @@ function runTest(forcePooledConnectionsDropped) {
assert.commandWorked(db.adminCommand({setFeatureCompatibilityVersion: lastLTSFCV}));
}`;
- let awaitShell = startParallelShell(codeToRunInParallelShell, mongos.port);
+ awaitShell = startParallelShell(codeToRunInParallelShell, mongos.port);
if (forcePooledConnectionsDropped) {
pauseBeforeCloseCxns.wait();
@@ -88,8 +104,7 @@ function runTest(forcePooledConnectionsDropped) {
jsTestLog("Turn off pause before pauseBeforeMarkKeepOpen failpoint");
pauseBeforeMarkKeepOpen.off();
}
-
- awaitShell();
+ checkCoordinatorDoc();
},
{
expectedErrorCode: [
@@ -98,6 +113,8 @@ function runTest(forcePooledConnectionsDropped) {
]
});
+ awaitShell();
+
reshardingTest.withReshardingInBackground(
{
newShardKeyPattern: {newKey: 1},
@@ -107,7 +124,14 @@ function runTest(forcePooledConnectionsDropped) {
],
},
() => {
- assert.commandWorked(mongos.adminCommand({setFeatureCompatibilityVersion: latestFCV}));
+ assert.soon(() => {
+ return mongos.getDB('config').reshardingOperations.findOne() != null;
+ }, "timed out waiting for coordinator doc to be written", 30 * 1000);
+ awaitShell = startParallelShell(funWithArgs(function(latestFCV) {
+ assert.commandWorked(db.adminCommand(
+ {setFeatureCompatibilityVersion: latestFCV}));
+ }, latestFCV), mongos.port);
+ checkCoordinatorDoc();
},
{
expectedErrorCode: [
@@ -117,6 +141,7 @@ function runTest(forcePooledConnectionsDropped) {
]
});
+ awaitShell();
reshardingTest.teardown();
}