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:37:47 -0400
commita0042dc2e3a440e0787fe8bb95bb99308ea36516 (patch)
treef8aa6b9760fba5ae567d65ad02ad2c9f037dd128
parentfc8f1106f494f24cb2559aa22c11aa825523541f (diff)
downloadmongo-a0042dc2e3a440e0787fe8bb95bb99308ea36516.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 ce12d5feb98..f3618ec9673 100644
--- a/jstests/noPassthrough/libs/backup_restore.js
+++ b/jstests/noPassthrough/libs/backup_restore.js
@@ -192,7 +192,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) {
@@ -399,6 +400,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,
@@ -412,6 +415,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');