diff options
author | Dan Pasette <dan@10mongodb.com> | 2014-10-13 16:21:50 -0400 |
---|---|---|
committer | Dan Pasette <dan@mongodb.com> | 2014-10-13 16:21:50 -0400 |
commit | 2917253b7cd11d2a856c99552bb8fc41899c4ae0 (patch) | |
tree | 4ce8f9ac22aaed523843973ecfc3321a02ff9254 /jstests/mmap_v1 | |
parent | e9c91c4ae2206f3292ebef86c973c400b2a5911f (diff) | |
download | mongo-2917253b7cd11d2a856c99552bb8fc41899c4ae0.tar.gz |
SERVER-13635: move journal test to mmapv1 suite
Diffstat (limited to 'jstests/mmap_v1')
-rw-r--r-- | jstests/mmap_v1/dur_remove_old_journals.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/jstests/mmap_v1/dur_remove_old_journals.js b/jstests/mmap_v1/dur_remove_old_journals.js new file mode 100644 index 00000000000..e309eee7b2d --- /dev/null +++ b/jstests/mmap_v1/dur_remove_old_journals.js @@ -0,0 +1,52 @@ +// this test makes sure that old journal files are removed + +// tunables +STRING_SIZE = 1024*1024; +NUM_TO_INSERT = 2.5*1024; +PATH = MongoRunner.dataDir + "/dur_remove_old_journals"; +SYNC_DELAY = 5; // must be a number + +conn = startMongodEmpty("--port", 30001, "--dbpath", PATH, "--dur", "--smallfiles", "--syncdelay", ''+SYNC_DELAY); +db = conn.getDB("test"); + +longString = 'x'; +while (longString.length < STRING_SIZE) + longString += longString; + +numInserted = 0; +while (numInserted < NUM_TO_INSERT){ + db.foo.insert({_id: numInserted++, s:longString}); + + + if (numInserted % 100 == 0){ + print("numInserted: " + numInserted); + db.adminCommand({fsync:1}); + db.foo.remove({}); + db.adminCommand({fsync:1}); + } +} + +sleepSecs = SYNC_DELAY + 15 // long enough for data file flushing and journal keep time +print("\nWaiting " + sleepSecs + " seconds...\n"); +sleep(sleepSecs*1000); + + +files = listFiles(PATH + "/journal") +printjson(files); + +var nfiles = 0; +files.forEach(function (file) { + assert.eq('string', typeof (file.name)); // sanity checking + if (/prealloc/.test(file.name)) { + ; + } + else { + nfiles++; + } +}) + +assert.eq(2, nfiles); // latest journal file and lsn + +stopMongod(30001); + +print("*** success ***"); |