summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXuerui Fa <xuerui.fa@mongodb.com>2020-05-18 16:51:27 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-18 21:53:41 +0000
commita29647888b6d8c50612c1609522302b3ac16071e (patch)
treef731b61b0684ef828ed9060eef10c17430ef02d2
parentc15f21fa5f7c20c2747f06a100ffb8d263f4558a (diff)
downloadmongo-a29647888b6d8c50612c1609522302b3ac16071e.tar.gz
SERVER-48250: Wait for hang in majority write before stepping down primary in write_concern_after_stepdown_and_stepup.js
-rw-r--r--jstests/replsets/write_concern_after_stepdown_and_stepup.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/jstests/replsets/write_concern_after_stepdown_and_stepup.js b/jstests/replsets/write_concern_after_stepdown_and_stepup.js
index 3cd88cfcf57..1bcaad85244 100644
--- a/jstests/replsets/write_concern_after_stepdown_and_stepup.js
+++ b/jstests/replsets/write_concern_after_stepdown_and_stepup.js
@@ -7,6 +7,7 @@
'use strict';
load("jstests/replsets/rslib.js");
+load("jstests/libs/fail_point_util.js");
load("jstests/libs/write_concern_util.js");
var name = "writeConcernStepDownAndBackUp";
@@ -51,8 +52,8 @@ assert.commandWorked(nodes[0].getDB(dbName).getCollection(collName).insert(
// Stop the secondaries from replicating.
stopServerReplication(secondaries);
// Stop the primary from calling into awaitReplication()
-assert.commandWorked(nodes[0].adminCommand(
- {configureFailPoint: 'hangBeforeWaitingForWriteConcern', mode: 'alwaysOn'}));
+const hangBeforeWaitingForWriteConcern =
+ configureFailPoint(nodes[0], "hangBeforeWaitingForWriteConcern");
jsTestLog("Do w:majority write that won't enter awaitReplication() until after the primary " +
"has stepped down and back up");
@@ -69,6 +70,8 @@ var doMajorityWrite = function() {
};
var joinMajorityWriter = startParallelShell(doMajorityWrite, nodes[0].port);
+// Ensure the parallel shell hangs on the majority write before stepping the primary down.
+hangBeforeWaitingForWriteConcern.wait();
jsTest.log("Disconnect primary from all secondaries");
nodes[0].disconnect(nodes[1]);
@@ -112,8 +115,7 @@ stepUp(nodes[0]);
jsTest.log("Unblock the thread waiting for replication of the now rolled-back write, ensure " +
"that the write concern failed");
-assert.commandWorked(
- nodes[0].adminCommand({configureFailPoint: 'hangBeforeWaitingForWriteConcern', mode: 'off'}));
+hangBeforeWaitingForWriteConcern.off();
joinMajorityWriter();