summaryrefslogtreecommitdiff
path: root/jstests/dur/checksum.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/dur/checksum.js')
-rw-r--r--jstests/dur/checksum.js39
1 files changed, 21 insertions, 18 deletions
diff --git a/jstests/dur/checksum.js b/jstests/dur/checksum.js
index 3914e3b84a0..0076024de66 100644
--- a/jstests/dur/checksum.js
+++ b/jstests/dur/checksum.js
@@ -11,12 +11,12 @@ if (0) {
// each insert is in it's own commit.
db.foo.insert({a: 1});
- db.runCommand({getlasterror:1, j:1});
+ db.runCommand({getlasterror: 1, j: 1});
db.foo.insert({a: 2});
- db.runCommand({getlasterror:1, j:1});
+ db.runCommand({getlasterror: 1, j: 1});
- MongoRunner.stopMongod(conn.port, /*signal*/9);
+ MongoRunner.stopMongod(conn.port, /*signal*/ 9);
jsTest.log("Journal file left at " + path + "/journal/j._0");
quit();
@@ -25,15 +25,16 @@ if (0) {
}
function startMongodWithJournal() {
- return MongoRunner.runMongod({restart: true,
- cleanData: false,
- dbpath: path,
- journal: "",
- smallfiles: "",
- journalOptions: 1 /*DurDumpJournal*/});
+ return MongoRunner.runMongod({
+ restart: true,
+ cleanData: false,
+ dbpath: path,
+ journal: "",
+ smallfiles: "",
+ journalOptions: 1 /*DurDumpJournal*/
+ });
}
-
jsTest.log("Starting with good.journal to make sure everything works");
resetDbpath(path);
mkdir(path + '/journal');
@@ -43,7 +44,6 @@ var db = conn.getDB('test');
assert.eq(db.foo.count(), 2);
MongoRunner.stopMongod(conn.port);
-
// dur_checksum_bad_last.journal is good.journal with the bad checksum on the last section.
jsTest.log("Starting with bad_last.journal");
resetDbpath(path);
@@ -51,10 +51,9 @@ mkdir(path + '/journal');
copyFile("jstests/libs/dur_checksum_bad_last.journal", path + "/journal/j._0");
conn = startMongodWithJournal();
var db = conn.getDB('test');
-assert.eq(db.foo.count(), 1); // 2nd insert "never happened"
+assert.eq(db.foo.count(), 1); // 2nd insert "never happened"
MongoRunner.stopMongod(conn.port);
-
// dur_checksum_bad_first.journal is good.journal with the bad checksum on the prior section.
// This means there is a good commit after the bad one. We currently ignore this, but a future
// version of the server may be able to detect this case.
@@ -64,7 +63,7 @@ mkdir(path + '/journal');
copyFile("jstests/libs/dur_checksum_bad_first.journal", path + "/journal/j._0");
conn = startMongodWithJournal();
var db = conn.getDB('test');
-assert.eq(db.foo.count(), 0); // Neither insert happened.
+assert.eq(db.foo.count(), 0); // Neither insert happened.
MongoRunner.stopMongod(conn.port);
// If we detect an error in a non-final journal file, that is considered an error.
@@ -75,12 +74,16 @@ copyFile("jstests/libs/dur_checksum_bad_first.journal", path + "/journal/j._0");
copyFile("jstests/libs/dur_checksum_good.journal", path + "/journal/j._1");
exitCode = runMongoProgram("mongod",
- "--port", allocatePort(),
- "--dbpath", path,
+ "--port",
+ allocatePort(),
+ "--dbpath",
+ path,
"--journal",
"--smallfiles",
- "--journalOptions", 1 /*DurDumpJournal*/
- + 2 /*DurScanOnly*/);
+ "--journalOptions",
+ 1 /*DurDumpJournal*/
+ +
+ 2 /*DurScanOnly*/);
assert.eq(exitCode, 100 /*EXIT_UNCAUGHT*/);