summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2015-11-19 14:21:42 -0500
committerCharlie Swanson <charlie.swanson@mongodb.com>2015-11-23 15:35:47 -0500
commit005ef273da33bf832e1e12886d8225c9498d349d (patch)
treefd8702f403ab815bcbe8f0030efb4c9fecff810d /src/mongo
parenta9deb75ef4ca314e3ba59c24f8bb09699769ce9d (diff)
downloadmongo-005ef273da33bf832e1e12886d8225c9498d349d.tar.gz
SERVER-21543 Lengthen delay before deleting old journal files
Conflicts: jstests/mmap_v1/dur_remove_old_journals.js
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_journal.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/storage/mmap_v1/dur_journal.cpp b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
index 0ab2ff648ca..2888cbdec63 100644
--- a/src/mongo/db/storage/mmap_v1/dur_journal.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
@@ -674,7 +674,11 @@ void Journal::removeUnneededJournalFiles() {
while (!_oldJournalFiles.empty()) {
JFile f = _oldJournalFiles.front();
- if (f.lastEventTimeMs < _lastFlushTime + ExtraKeepTimeMs) {
+ // 'f.lastEventTimeMs' is the timestamp of the last thing in the journal file.
+ // '_lastFlushTime' is the start time of the last successful flush of the data files to
+ // disk. We can't delete this journal file until the last successful flush time is at least
+ // 10 seconds after 'f.lastEventTimeMs'.
+ if (f.lastEventTimeMs + ExtraKeepTimeMs < _lastFlushTime) {
// eligible for deletion
boost::filesystem::path p(f.filename);
log() << "old journal file will be removed: " << f.filename << endl;