summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2017-03-24 14:07:51 -0400
committerBenety Goh <benety@mongodb.com>2017-03-24 16:19:47 -0400
commit25562f3145033c8a63df8831c26e9525341ab0d4 (patch)
tree7459d57dbbe6d5c76397de177451177098a8616a
parent65fa51f459d54f31fdb30d44d5c17c700b9ff4b2 (diff)
downloadmongo-25562f3145033c8a63df8831c26e9525341ab0d4.tar.gz
SERVER-28486 backup_restore.js waits for FSM and CRUD operations to complete before getting primary
-rw-r--r--jstests/noPassthrough/libs/backup_restore.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/jstests/noPassthrough/libs/backup_restore.js b/jstests/noPassthrough/libs/backup_restore.js
index b4e02415081..e66f0f8af97 100644
--- a/jstests/noPassthrough/libs/backup_restore.js
+++ b/jstests/noPassthrough/libs/backup_restore.js
@@ -352,15 +352,31 @@ var BackupRestoreTest = function(options) {
stopMongoProgramByPid(fsmPid);
// Wait up to 5 minutes until the new hidden node is in state SECONDARY.
+ jsTestLog('CRUD and FSM clients stopped. Waiting for hidden node ' + hiddenHost +
+ ' to become SECONDARY');
rst.waitForState(hiddenNode, ReplSetTest.State.SECONDARY);
// Wait for secondaries to finish catching up before shutting down.
+ jsTestLog(
+ 'Hidden node ' + hiddenHost +
+ ' is now SECONDARY. Waiting for CRUD and FSM operations to be applied on all nodes.');
+ rst.awaitReplication();
+
+ jsTestLog('CRUD and FSM operations successfully applied on all nodes. ' +
+ 'Waiting for all nodes to agree on the primary.');
rst.awaitNodesAgreeOnPrimary();
+
+ jsTestLog('All nodes agree on the primary. Getting current primary.');
primary = rst.getPrimary();
- assert.writeOK(primary.getDB("test").foo.insert(
- {}, {writeConcern: {w: rst.nodes.length, wtimeout: 10 * 60 * 1000}}));
+
+ jsTestLog('Inserting single document into primary ' + primary.host +
+ ' with writeConcern w:' + rst.nodes.length);
+ var writeResult = assert.writeOK(primary.getDB("test").foo.insert(
+ {}, {writeConcern: {w: rst.nodes.length, wtimeout: ReplSetTest.kDefaultTimeoutMS}}));
// Stop set.
+ jsTestLog('Insert operation successful: ' + tojson(writeResult) +
+ '. Stopping replica set.');
rst.stopSet();
// Cleanup the files from the test