void DurableImpl::commitAndStopDurThread(OperationContext* txn) { // This is only called by clean shutdown and the global lock must be held to ensure // there will not be any more writes. invariant(txn->lockState()->isW()); commitNow(txn); shutdownRequested.store(1); }
void DurableImpl::syncDataAndTruncateJournal(OperationContext* txn) { invariant(txn->lockState()->isW()); // Once this returns, all the outstanding journal has been applied to the data files and // so it's safe to do the flushAll/journalCleanup below. commitNow(txn); // Flush the shared view to disk. MongoFile::flushAll(true); // Once the shared view has been flushed, we do not need the journal files anymore. journalCleanup(true); // Double check post-conditions invariant(!haveJournalFiles()); }
void DurableImpl::syncDataAndTruncateJournal(OperationContext* txn) { invariant(txn->lockState()->isW()); // a commit from the commit thread won't begin while we are in the write lock, // but it may already be in progress and the end of that work is done outside // (dbMutex) locks. This line waits for that to complete if already underway. { SimpleMutex::scoped_lock lk(commitJob.groupCommitMutex); } commitNow(txn); MongoFile::flushAll(true); journalCleanup(); invariant(!haveJournalFiles()); // Double check post-conditions }