summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdul Qadeer <abdul.qadeer@mongodb.com>2022-06-23 01:55:03 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-23 02:25:45 +0000
commit0113dc3c9b5bc4d677e8a304dd6dc6e26581c183 (patch)
treef7a6a9066c21ec1530da8aa8186c48a66d68f1a7
parent8d04153c3db149e9f6224e3c2cab31b8d66154fe (diff)
downloadmongo-0113dc3c9b5bc4d677e8a304dd6dc6e26581c183.tar.gz
SERVER-66736 Remove redefined startParallelShell() and fix test
-rw-r--r--jstests/libs/test_background_ops.js51
-rw-r--r--jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js5
-rw-r--r--jstests/sharding/recover_multiple_migrations_on_stepup.js8
3 files changed, 19 insertions, 45 deletions
diff --git a/jstests/libs/test_background_ops.js b/jstests/libs/test_background_ops.js
index f0bf0ced476..f08ab644b98 100644
--- a/jstests/libs/test_background_ops.js
+++ b/jstests/libs/test_background_ops.js
@@ -76,29 +76,7 @@ var getResult = function(mongo, name) {
return mongo.getCollection("config.testResult").findOne({_id: name});
};
-/**
- * Overrides the parallel shell code in mongo
- */
-function startParallelShell(jsCode, port) {
- if (TestData) {
- jsCode = "TestData = " + tojson(TestData) + ";" + jsCode;
- }
-
- var x;
- if (port) {
- x = startMongoProgramNoConnect("mongo", "--port", port, "--eval", jsCode);
- } else {
- x = startMongoProgramNoConnect("mongo", "--eval", jsCode, db ? db.getMongo().host : null);
- }
-
- return function() {
- jsTestLog("Waiting for shell " + x + "...");
- waitProgram(x);
- jsTestLog("Shell " + x + " finished.");
- };
-}
-
-startParallelOps = function(mongo, proc, args, context) {
+var startParallelOps = function(mongo, proc, args, context) {
var procName = proc.name + "-" + new ObjectId();
var seed = new ObjectId(new ObjectId().valueOf().split("").reverse().join(""))
.getTimestamp()
@@ -201,31 +179,24 @@ startParallelOps = function(mongo, proc, args, context) {
db = oldDB;
- var join = function() {
+ var join = function(options = {}) {
+ const {checkExitSuccess = true} = options;
+ delete options.checkExitSuccess;
setFinished(mongo, procName, true);
- rawJoin();
+ rawJoin(options);
+
result = getResult(mongo, procName);
assert.neq(result, null);
- if (result.err)
+ if (!checkExitSuccess) {
+ return result;
+ } else if (checkExitSuccess && result.err) {
throw Error("Error in parallel ops " + procName + " : " + tojson(result.err));
-
- else
+ } else {
return result.result;
- };
-
- join.isFinished = function() {
- return isFinished(mongo, procName);
- };
-
- join.setFinished = function(finished) {
- return setFinished(mongo, procName, finished);
- };
-
- join.waitForLock = function(name) {
- return waitForLock(mongo, name);
+ }
};
return join;
diff --git a/jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js b/jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js
index ff4f0480d2a..6a465fc1d2e 100644
--- a/jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js
+++ b/jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js
@@ -76,14 +76,15 @@ try {
"Starting a parallel shell to run a transaction with a second index build request...");
joinSecondIndexBuild = startParallelShell(
funWithArgs(runFailedIndexBuildInTxn, dbName, collName, indexSpecB, 2), primary.port);
-
+ // We wait to observe the second attempt to build the index fails while the
+ // hangAfterSettingUpIndexBuild is preventing the first attempt from completing successfully.
+ joinSecondIndexBuild();
} finally {
assert.commandWorked(
testDB.adminCommand({configureFailPoint: 'hangAfterSettingUpIndexBuild', mode: 'off'}));
}
joinFirstIndexBuild();
-joinSecondIndexBuild();
// We should have the _id index and the 'the_b_1_index' index just built.
assert.eq(testColl.getIndexes().length, 2);
diff --git a/jstests/sharding/recover_multiple_migrations_on_stepup.js b/jstests/sharding/recover_multiple_migrations_on_stepup.js
index 03095e58864..828dac143cf 100644
--- a/jstests/sharding/recover_multiple_migrations_on_stepup.js
+++ b/jstests/sharding/recover_multiple_migrations_on_stepup.js
@@ -57,9 +57,8 @@ joinMoveChunk1();
// Start a second migration on a different collection, wait until it persists it's recovery document
// and then step down the donor.
var moveChunkHangAtStep3Failpoint = configureFailPoint(st.rs0.getPrimary(), "moveChunkHangAtStep3");
-// NOTE: The test doesn't join this parallel migration to avoid the check on its outcome,
-// which is not deterministic when executed in a configsvr stepdown suite (SERVER-62419)
-moveChunkParallel(staticMongod, st.s0.host, {_id: 0}, null, nsB, st.shard1.shardName);
+var joinMoveChunk2 =
+ moveChunkParallel(staticMongod, st.s0.host, {_id: 0}, null, nsB, st.shard1.shardName);
moveChunkHangAtStep3Failpoint.wait();
@@ -74,6 +73,9 @@ assert.eq(2, st.rs0.getPrimary().getDB('config')['migrationCoordinators'].countD
// Stepdown the donor shard
assert.commandWorked(st.rs0.getPrimary().adminCommand({replSetStepDown: 5, force: true}));
moveChunkHangAtStep3Failpoint.off();
+// NOTE: checkExitSuccess is false because the outcome is not deterministic when executed in a
+// configsvr stepdown suite (SERVER-62419)
+joinMoveChunk2({checkExitSuccess: false});
// Check that the donor shard has been able to recover the shard version for both collections.
assert.eq(0, collA.find().itcount());