mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
crlf
This commit is contained in:
parent
ba60f49b46
commit
2173d54bd0
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user