summaryrefslogtreecommitdiff
path: root/jstests/replsets
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-05-17 11:46:22 -0400
committerJudah Schvimer <judah@mongodb.com>2017-05-17 11:46:22 -0400
commit2482a5807dfa624f358569c727ff3b96ccfd8922 (patch)
treeffd8f4b949e3187705900b3204d05dcc344ab26f /jstests/replsets
parentf92d87b3cbe19941f7cf27b0fbf82af818503866 (diff)
downloadmongo-2482a5807dfa624f358569c727ff3b96ccfd8922.tar.gz
SERVER-28846 Use IDL to generate oplog entry parsers
Diffstat (limited to 'jstests/replsets')
-rw-r--r--jstests/replsets/rollback_cmd_unrollbackable.js2
-rw-r--r--jstests/replsets/rollback_fake_cmd.js90
2 files changed, 1 insertions, 91 deletions
diff --git a/jstests/replsets/rollback_cmd_unrollbackable.js b/jstests/replsets/rollback_cmd_unrollbackable.js
index 661f9ead68a..0abc3384db6 100644
--- a/jstests/replsets/rollback_cmd_unrollbackable.js
+++ b/jstests/replsets/rollback_cmd_unrollbackable.js
@@ -49,7 +49,7 @@ var oplog_entry = b_conn.getDB("local").oplog.rs.find().sort({$natural: -1})[0];
oplog_entry["ts"] = Timestamp(oplog_entry["ts"].t, oplog_entry["ts"].i + 1);
oplog_entry["op"] = "c";
oplog_entry["o"] = {
- "replSetSyncFrom": 1
+ "emptycapped": 1
};
assert.writeOK(b_conn.getDB("local").oplog.rs.insert(oplog_entry));
diff --git a/jstests/replsets/rollback_fake_cmd.js b/jstests/replsets/rollback_fake_cmd.js
deleted file mode 100644
index bbc82e56156..00000000000
--- a/jstests/replsets/rollback_fake_cmd.js
+++ /dev/null
@@ -1,90 +0,0 @@
-// test that a rollback of a nonexistent command causes a message to be logged
-//
-// If all data-bearing nodes in a replica set are using an ephemeral storage engine, the set will
-// not be able to survive a scenario where all data-bearing nodes are down simultaneously. In such a
-// scenario, none of the members will have any data, and upon restart will each look for a member to
-// inital sync from, so no primary will be elected. This test induces such a scenario, so cannot be
-// run on ephemeral storage engines.
-// @tags: [requires_persistence]
-
-// function to check the logs for an entry
-doesEntryMatch = function(array, regex) {
- var found = false;
- for (i = 0; i < array.length; i++) {
- if (regex.test(array[i])) {
- found = true;
- }
- }
- return found;
-};
-
-// set up a set and grab things for later
-var name = "rollback_fake_cmd";
-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}
- ]
-});
-var a_conn = conns[0];
-var b_conn = conns[1];
-var AID = replTest.getNodeId(a_conn);
-var BID = replTest.getNodeId(b_conn);
-
-replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY);
-
-// get master and do an initial write
-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};
-assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options));
-
-// shut down master
-replTest.stop(AID);
-
-// insert a fake oplog entry with a nonexistent command
-master = replTest.getPrimary();
-assert(b_conn.host === master.host, "b_conn assumed to be master");
-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];
-oplog_entry.ts = Timestamp(oplog_entry.ts.t, oplog_entry.ts.i + 1);
-oplog_entry.op = "c";
-oplog_entry.o = {
- fake_command_name: 1
-};
-assert.writeOK(b_conn.getDB("local").oplog.rs.insert(oplog_entry));
-jsTestLog('inserted oplog entry with invalid command: ' + tojson(oplog_entry));
-
-// shut down B and bring back the original master
-replTest.stop(BID);
-replTest.restart(AID);
-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
-};
-assert.writeOK(a_conn.getDB(name).foo.insert({x: 2}, options));
-
-// restart B, which should rollback and log a message about not rolling back the nonexistent cmd
-clearRawMongoProgramOutput();
-replTest.restart(BID);
-var msg = RegExp("rollback no such command fake_command_name");
-assert.soon(function() {
- return rawMongoProgramOutput().match(msg);
-}, "Did not see a log entry about skipping the nonexistent command during rollback");
-
-replTest.stopSet(undefined, undefined, {allowedExitCodes: [MongoRunner.EXIT_ABRUPT]});