diff options
author | dwight <dwight@10gen.com> | 2010-12-27 15:33:33 -0500 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2010-12-27 15:33:52 -0500 |
commit | 99eb5e363e7bfd37ca765f89f86afd5568673e65 (patch) | |
tree | 7dc995857d579e3b860b8efda05e72cfcaef0711 /db/dur_journal.cpp | |
parent | d38d0a7ab6a6e0c90b5b646b0672c5009cbc5d39 (diff) | |
download | mongo-99eb5e363e7bfd37ca765f89f86afd5568673e65.tar.gz |
clean lsnThread shutdown
Diffstat (limited to 'db/dur_journal.cpp')
-rw-r--r-- | db/dur_journal.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/db/dur_journal.cpp b/db/dur_journal.cpp index 20da473ed90..5c5a9d5cfba 100644 --- a/db/dur_journal.cpp +++ b/db/dur_journal.cpp @@ -83,6 +83,8 @@ namespace mongo { Journal j; + const unsigned long long LsnShutdownSentinel = ~((unsigned long long)0); + Journal::Journal() : toUnlink(*(new MVar<path>)), /* freeing MVar at program termination would be problematic */ toStoreLastSeqNum(*(new MVar<unsigned long long>)), @@ -157,11 +159,14 @@ namespace mongo { /** at clean shutdown */ bool okToCleanUp = false; // failed recovery would set this to false - void journalCleanup() { + void journalCleanupAtShutdown() { if( testIntent ) return; if( !okToCleanUp ) return; + + j.toStoreLastSeqNum.put(LsnShutdownSentinel); + if( !j.tryToCloseCurJournalFile() ) { return; } @@ -284,6 +289,8 @@ namespace mongo { time_t last = 0; while( 1 ) { unsigned long long lsn = j.toStoreLastSeqNum.take(); + if( LsnShutdownSentinel == lsn ) + break; // if you are on a really fast fsync interval, we don't write this as often if( time(0) - last < 5 ) @@ -304,6 +311,8 @@ namespace mongo { log() << "write to lsn file fails " << e.what() << endl; } } + + cc().shutdown(); } void Journal::preFlush() { |