summaryrefslogtreecommitdiff
path: root/jstests/replsets/rollback_empty_ns.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/replsets/rollback_empty_ns.js')
-rw-r--r--jstests/replsets/rollback_empty_ns.js32
1 files changed, 21 insertions, 11 deletions
diff --git a/jstests/replsets/rollback_empty_ns.js b/jstests/replsets/rollback_empty_ns.js
index 77116668971..f6a07319eb4 100644
--- a/jstests/replsets/rollback_empty_ns.js
+++ b/jstests/replsets/rollback_empty_ns.js
@@ -23,12 +23,14 @@ var name = "rollback_empty_ns";
var replTest = new ReplSetTest({name: name, nodes: 3});
var nodes = replTest.nodeList();
var conns = replTest.startSet();
-replTest.initiate({"_id": name,
- "members": [
- { "_id": 0, "host": nodes[0], priority: 3 },
- { "_id": 1, "host": nodes[1] },
- { "_id": 2, "host": nodes[2], arbiterOnly: true}]
- });
+replTest.initiate({
+ "_id": name,
+ "members": [
+ {"_id": 0, "host": nodes[0], priority: 3},
+ {"_id": 1, "host": nodes[1]},
+ {"_id": 2, "host": nodes[2], arbiterOnly: true}
+ ]
+});
var a_conn = conns[0];
var b_conn = conns[1];
var AID = replTest.getNodeId(a_conn);
@@ -40,7 +42,10 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000);
var master = replTest.getPrimary();
assert(master === conns[0], "conns[0] assumed to be master");
assert(a_conn.host === master.host, "a_conn assumed to be master");
-var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true};
+var options = {
+ writeConcern: {w: 2, wtimeout: 60000},
+ upsert: true
+};
assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options));
// shut down master
@@ -49,7 +54,10 @@ replTest.stop(AID);
// insert a fake oplog entry with an empty ns
master = replTest.getPrimary();
assert(b_conn.host === master.host, "b_conn assumed to be master");
-options = {writeConcern: {w: 1, wtimeout: 60000}, upsert: true};
+options = {
+ writeConcern: {w: 1, wtimeout: 60000},
+ upsert: true
+};
// another insert to set minvalid ahead
assert.writeOK(b_conn.getDB(name).foo.insert({x: 123}));
var oplog_entry = b_conn.getDB("local").oplog.rs.find().sort({$natural: -1})[0];
@@ -64,7 +72,10 @@ master = replTest.getPrimary();
assert(a_conn.host === master.host, "a_conn assumed to be master");
// do a write so that B will have to roll back
-options = {writeConcern: {w: 1, wtimeout: 60000}, upsert: true};
+options = {
+ writeConcern: {w: 1, wtimeout: 60000},
+ upsert: true
+};
assert.writeOK(a_conn.getDB(name).foo.insert({x: 2}, options));
// restart B, which should rollback and log a message about not rolling back empty ns'd oplog entry
@@ -74,8 +85,7 @@ assert.soon(function() {
try {
var log = b_conn.getDB("admin").adminCommand({getLog: "global"}).log;
return doesEntryMatch(log, msg);
- }
- catch (e) {
+ } catch (e) {
return false;
}
}, "Did not see a log entry about skipping the empty ns'd oplog entry during rollback");