diff options
Diffstat (limited to 'jstests/tool/oplog_all_ops.js')
-rw-r--r-- | jstests/tool/oplog_all_ops.js | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/jstests/tool/oplog_all_ops.js b/jstests/tool/oplog_all_ops.js index fb51f2b0b53..fb988174d24 100644 --- a/jstests/tool/oplog_all_ops.js +++ b/jstests/tool/oplog_all_ops.js @@ -4,10 +4,10 @@ * Correctness is verified using the dbhash command. */ -var repl1 = new ReplSetTest({ name: 'rs1', nodes: [{ nopreallocj: '' }, - { arbiter: true }, { arbiter: true }]}); +var repl1 = + new ReplSetTest({name: 'rs1', nodes: [{nopreallocj: ''}, {arbiter: true}, {arbiter: true}]}); -repl1.startSet({ oplogSize: 10 }); +repl1.startSet({oplogSize: 10}); repl1.initiate(); repl1.awaitSecondaryNodes(); @@ -16,52 +16,44 @@ var testDB = repl1Conn.getDB('test'); var testColl = testDB.user; // op i -testColl.insert({ x: 1 }); -testColl.insert({ x: 2 }); +testColl.insert({x: 1}); +testColl.insert({x: 2}); // op c testDB.dropDatabase(); -testColl.insert({ y: 1 }); -testColl.insert({ y: 2 }); -testColl.insert({ y: 3 }); +testColl.insert({y: 1}); +testColl.insert({y: 2}); +testColl.insert({y: 3}); // op u -testColl.update({}, { $inc: { z: 1 }}, true, true); +testColl.update({}, {$inc: {z: 1}}, true, true); // op d -testColl.remove({ y: 2 }); +testColl.remove({y: 2}); // op n var oplogColl = repl1Conn.getCollection('local.oplog.rs'); -oplogColl.insert({ ts: new Timestamp(), op: 'n', ns: testColl.getFullName(), 'o': { x: 'noop' }}); - -var repl2 = new ReplSetTest({ - name: 'rs2', - nodes: [ - {nopreallocj: ''}, - {arbiter: true}, - {arbiter: true} - ] -}); - -repl2.startSet({ oplogSize: 10 }); +oplogColl.insert({ts: new Timestamp(), op: 'n', ns: testColl.getFullName(), 'o': {x: 'noop'}}); + +var repl2 = + new ReplSetTest({name: 'rs2', nodes: [{nopreallocj: ''}, {arbiter: true}, {arbiter: true}]}); + +repl2.startSet({oplogSize: 10}); repl2.initiate(); repl2.awaitSecondaryNodes(); var srcConn = repl1.getPrimary(); -runMongoProgram('mongooplog', '--from', repl1.getPrimary().host, - '--host', repl2.getPrimary().host); +runMongoProgram('mongooplog', '--from', repl1.getPrimary().host, '--host', repl2.getPrimary().host); -var repl1Hash = testDB.runCommand({ dbhash: 1 }); +var repl1Hash = testDB.runCommand({dbhash: 1}); var repl2Conn = new Mongo(repl2.getURL()); var testDB2 = repl2Conn.getDB(testDB.getName()); -var repl2Hash = testDB2.runCommand({ dbhash: 1 }); +var repl2Hash = testDB2.runCommand({dbhash: 1}); assert(repl1Hash.md5); assert.eq(repl1Hash.md5, repl2Hash.md5); repl1.stopSet(); repl2.stopSet(); - |