diff options
Diffstat (limited to 'jstests/tool/dumprestore7.js')
-rw-r--r-- | jstests/tool/dumprestore7.js | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/jstests/tool/dumprestore7.js b/jstests/tool/dumprestore7.js index 9a7d09665ef..0598e73c0a8 100644 --- a/jstests/tool/dumprestore7.js +++ b/jstests/tool/dumprestore7.js @@ -8,7 +8,7 @@ function step(msg) { step(); -var replTest = new ReplSetTest( {name: name, nodes: 1} ); +var replTest = new ReplSetTest({name: name, nodes: 1}); var nodes = replTest.startSet(); replTest.initiate(); var master = replTest.getPrimary(); @@ -17,14 +17,20 @@ var master = replTest.getPrimary(); step("first chunk of data"); var foo = master.getDB("foo"); for (i = 0; i < 20; i++) { - foo.bar.insert({ x: i, y: "abc" }); + foo.bar.insert({x: i, y: "abc"}); } } { step("wait"); replTest.awaitReplication(); - var time = replTest.getPrimary().getDB("local").getCollection("oplog.rs").find().limit(1).sort({$natural:-1}).next(); + var time = replTest.getPrimary() + .getDB("local") + .getCollection("oplog.rs") + .find() + .limit(1) + .sort({$natural: -1}) + .next(); step(time.ts.t); } @@ -32,26 +38,29 @@ var master = replTest.getPrimary(); step("second chunk of data"); var foo = master.getDB("foo"); for (i = 30; i < 50; i++) { - foo.bar.insert({ x: i, y: "abc" }); + foo.bar.insert({x: i, y: "abc"}); } } -{ - var conn = MongoRunner.runMongod({}); -} +{ var conn = MongoRunner.runMongod({}); } step("try mongodump with $timestamp"); var data = MongoRunner.dataDir + "/dumprestore7-dump1/"; -var query = "{\"ts\":{\"$gt\":{\"$timestamp\":{\"t\":"+ time.ts.t + ",\"i\":" + time.ts.i +"}}}}"; +var query = "{\"ts\":{\"$gt\":{\"$timestamp\":{\"t\":" + time.ts.t + ",\"i\":" + time.ts.i + "}}}}"; -MongoRunner.runMongoTool( "mongodump", - { "host": "127.0.0.1:"+replTest.ports[0], - "db": "local", "collection": "oplog.rs", - "query": query, "out": data }); +MongoRunner.runMongoTool("mongodump", + { + "host": "127.0.0.1:" + replTest.ports[0], + "db": "local", + "collection": "oplog.rs", + "query": query, + "out": data + }); step("try mongorestore from $timestamp"); -runMongoProgram( "mongorestore", "--host", "127.0.0.1:"+conn.port, "--dir", data, "--writeConcern", 1); +runMongoProgram( + "mongorestore", "--host", "127.0.0.1:" + conn.port, "--dir", data, "--writeConcern", 1); var x = 9; x = conn.getDB("local").getCollection("oplog.rs").count(); @@ -61,4 +70,3 @@ step("stopSet"); replTest.stopSet(); step("SUCCESS"); - |