summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@10gen.com>2018-09-21 10:55:05 -0400
committerVesselina Ratcheva <vesselina.ratcheva@10gen.com>2018-10-25 18:48:01 -0400
commit1b8632701dc4c55dabee97cf39b5c1c018712541 (patch)
tree68a7dfec8a9250f93b10f044539c5f6b1a7606eb
parent365ae29ee335257398159f1b9f1f9767198fe607 (diff)
downloadmongo-1b8632701dc4c55dabee97cf39b5c1c018712541.tar.gz
SERVER-35570 Improve robustness of backup_restore.js around dropping test database
(cherry picked from commit 729a923ea4e0ba5518afb2efb0133aa5f5194391)
-rw-r--r--jstests/noPassthrough/libs/backup_restore.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/jstests/noPassthrough/libs/backup_restore.js b/jstests/noPassthrough/libs/backup_restore.js
index 4cdddd434b6..7eb5cd000ac 100644
--- a/jstests/noPassthrough/libs/backup_restore.js
+++ b/jstests/noPassthrough/libs/backup_restore.js
@@ -173,7 +173,8 @@ var BackupRestoreTest = function(options) {
};
var result = db.getSiblingDB('test').fsm_teardown.insert({a: 1}, wc);
assert.writeOK(result, 'teardown insert failed: ' + tojson(result));
- result = db.getSiblingDB('test').fsm_teardown.drop();
+ result = db.getSiblingDB('test').fsm_teardown.drop(
+ {writeConcern: {w: "majority"}});
assert(result, 'teardown drop failed');
});
} catch (e) {
@@ -384,6 +385,8 @@ var BackupRestoreTest = function(options) {
// Wait up to 5 minutes until the new hidden node is in state RECOVERING.
rst.waitForState(hiddenNode, [ReplSetTest.State.RECOVERING, ReplSetTest.State.SECONDARY]);
+ jsTestLog('Stopping CRUD and FSM clients');
+
// Stop CRUD client and FSM client.
var crudStatus = checkProgram(crudPid);
assert(crudStatus.alive,
@@ -397,6 +400,14 @@ var BackupRestoreTest = function(options) {
fsmStatus.exitCode);
stopMongoProgramByPid(fsmPid);
+ // Make sure the test database is not in a drop-pending state. This can happen if we
+ // killed the FSM client while it was in the middle of dropping it.
+ assert.soonNoExcept(function() {
+ let result = primary.getDB("test").afterClientKills.insert(
+ {"a": 1}, {writeConcern: {w: "majority"}});
+ return (result.nInserted === 1);
+ }, "failed to insert to test collection", 10 * 60 * 1000);
+
// 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');