summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2011-01-22 14:07:16 -0500
committerdwight <dwight@10gen.com>2011-01-22 14:07:16 -0500
commitf70a285449c1b934b496f905a97657f8f388b2e0 (patch)
tree02f2739ea284cfb30b8a47f7ec39d2017abf19eb
parent449f4e40c87ec742b179d06e45146f8937dda3d6 (diff)
downloadmongo-f70a285449c1b934b496f905a97657f8f388b2e0.tar.gz
try to fix md5.js test
-rw-r--r--db/dur_journalformat.h1
-rw-r--r--jstests/dur/md5.js17
2 files changed, 14 insertions, 4 deletions
diff --git a/db/dur_journalformat.h b/db/dur_journalformat.h
index 7256aae886d..2b6acc58de8 100644
--- a/db/dur_journalformat.h
+++ b/db/dur_journalformat.h
@@ -132,6 +132,7 @@ namespace mongo {
len -= sizeof(JSectHeader);
md5digest current;
md5(begin, len, current);
+ DEV log() << "checkHash len:" << len << " hash:" << toHex(hash, 16) << " current:" << toHex(current, 16) << endl;
return (memcmp(hash, current, sizeof(hash)) == 0);
}
};
diff --git a/jstests/dur/md5.js b/jstests/dur/md5.js
index f52ac79dfac..3fd678e133b 100644
--- a/jstests/dur/md5.js
+++ b/jstests/dur/md5.js
@@ -17,7 +17,7 @@ function log(str) {
print(testname+" step " + step++);
}
-/** Changes here may require updating the byte index of the md5 hash, see fuzzFile comments below. */
+/** Changes here may require updating the byte index of the md5 hash, see File comments below. */
function work() {
log("work");
var d = conn.getDB("test");
@@ -65,9 +65,18 @@ stopMongod(30001, /*signal*/9);
// journal file should be present, and non-empty as we killed hard
-// Bit flip the first byte of the md5sum contained within the opcode footer.
-// This ensures we get an md5 exception instead of some other type of exception.
-fuzzFile( path + "/journal/j._0", 39755 );
+// Bit flip the first byte of the md5sum contained within the opcode footer.
+// This ensures we get an md5 exception instead of some other type of exception.
+var file = path + "/journal/j._0";
+//run("cp", file, "/tmp/before");
+//fuzzFile(file, 39755);
+
+// journal header is 8192
+// jsectheader is 12
+// so a little beyond that
+fuzzFile(file, 8214);
+
+//run("cp", file, "/tmp/after");
log("run mongod again recovery should fail");