summaryrefslogtreecommitdiff
path: root/jstests/replsets/stepdown_killop.js
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2015-10-15 18:37:15 -0400
committerBenety Goh <benety@mongodb.com>2015-10-16 10:45:01 -0400
commit469814c1c12cbe1f7f511c5d7c952b909378a3c0 (patch)
tree856efdad5bb016dba640a272c92e8ff7a708086e /jstests/replsets/stepdown_killop.js
parent755fea23f219666f2e5d5de25d087baeacef1503 (diff)
downloadmongo-469814c1c12cbe1f7f511c5d7c952b909378a3c0.tar.gz
SERVER-20964 use failpoint instead of bridging to prevent secondary from catching with primary during step down
Diffstat (limited to 'jstests/replsets/stepdown_killop.js')
-rw-r--r--jstests/replsets/stepdown_killop.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/jstests/replsets/stepdown_killop.js b/jstests/replsets/stepdown_killop.js
index 8e958fdb1e9..b3b09388808 100644
--- a/jstests/replsets/stepdown_killop.js
+++ b/jstests/replsets/stepdown_killop.js
@@ -1,6 +1,6 @@
// Ensure stepDown operations that are waiting for replication can be interrupted with killOp()
// 1. Start up a 3 node set (1 arbiter).
-// 2. Isolate the SECONDARY.
+// 2. Stop replication on the SECONDARY using a fail point.
// 3. Do one write and then spin up a second shell which asks the PRIMARY to StepDown.
// 4. Once StepDown has begun, spin up a third shell which will attempt to do writes, which should
// block waiting for stepDown to release its lock, which it never will do because no secondaries
@@ -20,12 +20,18 @@
{"_id" : 1, "host" : nodes[1]},
{"_id" : 2, "host" : nodes[2], "arbiterOnly" : true}]});
- jsTestLog("Isolating primary");
- replSet.bridge();
- replSet.partition(1,0);
- replSet.partition(1,2);
+ replSet.waitForState(replSet.nodes[0], replSet.PRIMARY, 60 * 1000);
- replSet.waitForState(replSet.nodes[0], replSet.PRIMARY, 60 * 1000);
+ var secondary = replSet.getSecondary();
+ jsTestLog('Disable replication on the SECONDARY ' + secondary.host);
+ assert.commandWorked(
+ secondary.getDB('admin').runCommand(
+ {configureFailPoint: 'rsSyncApplyStop', mode: 'alwaysOn'}
+ ),
+ 'Failed to configure rsSyncApplyStop failpoint.'
+ );
+
+ replSet.waitForState(replSet.nodes[0], replSet.PRIMARY, 60 * 1000);
var primary = replSet.getPrimary();
assert.eq(primary.host, nodes[0], "primary assumed to be node 0");