summaryrefslogtreecommitdiff
path: root/src/mongo/db/dur_journal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/dur_journal.cpp')
-rw-r--r--src/mongo/db/dur_journal.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/dur_journal.cpp b/src/mongo/db/dur_journal.cpp
index bb466139f2e..a19032bc4c0 100644
--- a/src/mongo/db/dur_journal.cpp
+++ b/src/mongo/db/dur_journal.cpp
@@ -669,7 +669,11 @@ namespace mongo {
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;