summaryrefslogtreecommitdiff
path: root/jstests/replsets/rollback.js
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2010-08-13 18:16:03 -0400
committerdwight <dwight@10gen.com>2010-08-13 18:16:03 -0400
commit02cbcfa464ee569f3948d020e46f40224b244a43 (patch)
tree58cf8926650a96756b5dcc3644ca9f9223d4fe05 /jstests/replsets/rollback.js
parent1bf648b529e51dea9f686745e66038b674d11a1b (diff)
downloadmongo-02cbcfa464ee569f3948d020e46f40224b244a43.tar.gz
rs make test better
Diffstat (limited to 'jstests/replsets/rollback.js')
-rw-r--r--jstests/replsets/rollback.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/replsets/rollback.js b/jstests/replsets/rollback.js
index f072d61b67c..46944069487 100644
--- a/jstests/replsets/rollback.js
+++ b/jstests/replsets/rollback.js
@@ -72,6 +72,31 @@ doTest = function (signal) {
// Wait for initial replication
var a = a_conn.getDB("foo");
var b = b_conn.getDB("foo");
+
+ /* force the oplog to roll */
+ if (new Date() % 2 == 0) {
+ print("ROLLING OPLOG AS PART OF TEST (we only do this sometimes)");
+ var pass = 1;
+ var first = a.getSisterDB("local").oplog.rs.find().sort({ $natural: 1 }).limit(1)[0];
+ a.roll.insert({ x: 1 });
+ while (1) {
+ for (var i = 0; i < 10000; i++)
+ a.roll.update({}, { $inc: { x: 1} });
+ var op = a.getSisterDB("local").oplog.rs.find().sort({ $natural: 1 }).limit(1)[0];
+ if (tojson(op.h) != tojson(first.h)) {
+ printjson(op);
+ printjson(first);
+ break;
+ }
+ pass++;
+ a.getLastError(2); // unlikely secondary isn't keeping up, but let's avoid possible intermittent issues with that.
+ }
+ print("PASSES FOR OPLOG ROLL: " + pass);
+ }
+ else {
+ print("NO ROLL");
+ }
+
a.bar.insert({ q: 1, a: "foo" });
a.bar.insert({ q: 2, a: "foo", x: 1 });
a.bar.insert({ q: 3, bb: 9, a: "foo" });