diff options
Diffstat (limited to 'jstests/dur')
-rwxr-xr-x | jstests/dur/manyRestart.js | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/jstests/dur/manyRestart.js b/jstests/dur/manyRestart.js index e54c3b3414c..956fd034224 100755 --- a/jstests/dur/manyRestart.js +++ b/jstests/dur/manyRestart.js @@ -5,23 +5,23 @@ var debugging = false; var testname = "manyRestarts"; var step = 1; -var conn = null;
-
-function checkNoJournalFiles(path, pass) {
- var files = listFiles(path);
- if (files.some(function (f) { return f.name.indexOf("prealloc") < 0; })) {
- if (pass == null) {
- // wait a bit longer for mongod to potentially finish if it is still running.
- sleep(10000);
- return checkNoJournalFiles(path, 1);
- }
- print("\n\n\n");
- print("FAIL path:" + path);
- print("unexpected files:");
- printjson(files);
- assert(false, "FAIL a journal/lsn file is present which is unexpected");
- }
-}
+var conn = null; + +function checkNoJournalFiles(path, pass) { + var files = listFiles(path); + if (files.some(function (f) { return f.name.indexOf("prealloc") < 0; })) { + if (pass == null) { + // wait a bit longer for mongod to potentially finish if it is still running. + sleep(10000); + return checkNoJournalFiles(path, 1); + } + print("\n\n\n"); + print("FAIL path:" + path); + print("unexpected files:"); + printjson(files); + assert(false, "FAIL a journal/lsn file is present which is unexpected"); + } +} function runDiff(a, b) { function reSlash(s) { @@ -127,17 +127,17 @@ sleep(5000); for (var i = 0; i < 3; ++i) { -// durable version -log("restarting 30001"); -conn = startMongodNoReset("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); - -verify(); - -// kill the process hard -log("hard kill"); -stopMongod(30001, /*signal*/9); - -sleep(5000); + // durable version + log("restarting 30001"); + conn = startMongodNoReset("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); + + verify(); + + // kill the process hard + log("hard kill"); + stopMongod(30001, /*signal*/9); + + sleep(5000); } // journal file should be present, and non-empty as we killed hard @@ -152,7 +152,7 @@ stopMongod(30002); sleep(5000); // at this point, after clean shutdown, there should be no journal files -log("check no journal files");
+log("check no journal files"); checkNoJournalFiles(path2 + "/journal"); log("check data matches ns"); @@ -168,20 +168,20 @@ log("check data matches done"); var nrows = 0; for (var i = 0; i < 5; ++i) { -// durable version -log("restarting 30001"); -conn = startMongodNoReset("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); -nrows += addRows(); -// wait for group commit. -printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1})); - -verifyRows(nrows); - -// kill the process hard -log("hard kill"); -stopMongod(30001, /*signal*/9); - -sleep(5000); + // durable version + log("restarting 30001"); + conn = startMongodNoReset("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8); + nrows += addRows(); + // wait for group commit. + printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1})); + + verifyRows(nrows); + + // kill the process hard + log("hard kill"); + stopMongod(30001, /*signal*/9); + + sleep(5000); } print(testname + " SUCCESS"); |