summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2011-02-07 12:22:32 -0500
committerdwight <dwight@10gen.com>2011-02-07 12:22:32 -0500
commit2173d54bd0440831c1378fd82ebb252abb7b01ce (patch)
treec294edc5bc07a5234ac2df38363e713517d70f33 /jstests
parentba60f49b460f63ce0ca153d91439069b2d349c01 (diff)
downloadmongo-2173d54bd0440831c1378fd82ebb252abb7b01ce.tar.gz
crlf
Diffstat (limited to 'jstests')
-rw-r--r--jstests/dur/dropdb.js68
1 files changed, 34 insertions, 34 deletions
diff --git a/jstests/dur/dropdb.js b/jstests/dur/dropdb.js
index 8e1aeffb2b6..72e02517aa2 100644
--- a/jstests/dur/dropdb.js
+++ b/jstests/dur/dropdb.js
@@ -4,23 +4,23 @@
var debugging = false;
var testname = "dropdb";
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) {
@@ -64,18 +64,18 @@ function work() {
d.foo.insert({ _id: 100 });
- // assure writes applied in case we kill -9 on return from this function
+ // assure writes applied in case we kill -9 on return from this function
assert(d.runCommand({ getlasterror: 1, fsync: 1 }).ok, "getlasterror not ok");
}
function verify() {
- log("verify");
- var d = conn.getDB("test");
- var count = d.foo.count();
- if (count != 1) {
- sleep(5000); // easier to read then
- print("\n\n\ndropdb.js FAIL test.foo.count() should be 1 but is : " + count + "\n\n\n");
- assert(false);
+ log("verify");
+ var d = conn.getDB("test");
+ var count = d.foo.count();
+ if (count != 1) {
+ sleep(5000); // easier to read then
+ print("\n\n\ndropdb.js FAIL test.foo.count() should be 1 but is : " + count + "\n\n\n");
+ assert(false);
}
assert(d.foo.findOne()._id == 100, "100");
@@ -112,26 +112,26 @@ stopMongod(30000);
log("mongod dur");
conn = startMongodEmpty("--port", 30001, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 8);
work();
-verify();
-
-// kill the process hard
+verify();
+
+// kill the process hard
log("kill 9");
stopMongod(30001, /*signal*/9);
// journal file should be present, and non-empty as we killed hard
-log("restart and recover");
-conn = startMongodNoReset("--port", 30002, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 9);
-
+log("restart and recover");
+conn = startMongodNoReset("--port", 30002, "--dbpath", path2, "--dur", "--smallfiles", "--durOptions", 9);
+
log("verify after recovery");
verify();
-log("stop mongod 30002");
-stopMongod(30002);
+log("stop mongod 30002");
+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");