diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2016-01-26 12:40:58 -0500 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2016-02-04 11:22:18 -0500 |
commit | c3d0eecc3cad249849734eae96096b8ad313ab04 (patch) | |
tree | 4faa4a6bc06cd5a99586f3ee9f603a37acac0b15 /src/mongo/db/storage/mmap_v1/dur.cpp | |
parent | 2c2e6a38f559f25559c2b24eff51511c6fbc4a5b (diff) | |
download | mongo-c3d0eecc3cad249849734eae96096b8ad313ab04.tar.gz |
SERVER-22269 make ReadConcern: majority reflect journaled state on PRIMARY
Diffstat (limited to 'src/mongo/db/storage/mmap_v1/dur.cpp')
-rw-r--r-- | src/mongo/db/storage/mmap_v1/dur.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp index 979fe0ab900..f50be1ce146 100644 --- a/src/mongo/db/storage/mmap_v1/dur.cpp +++ b/src/mongo/db/storage/mmap_v1/dur.cpp @@ -400,6 +400,11 @@ void remapPrivateViewImpl(double fraction) { DurableImpl durableImpl; NonDurableImpl nonDurableImpl; +// Notified when we commit to the journal. +static JournalListener* journalListener = &NoOpJournalListener::instance; +// Protects journalListener. +static stdx::mutex journalListenerMutex; + } // namespace @@ -730,6 +735,7 @@ static void durThread() { // writes (hasWritten == false). JournalWriter::Buffer* const buffer = journalWriter.newBuffer(); buffer->setNoop(); + buffer->journalListenerToken = getJournalListener()->getToken(); journalWriter.writeBuffer(buffer, commitNumber); } else { @@ -794,6 +800,7 @@ static void durThread() { autoFlushLock.release(); } + buffer->journalListenerToken = getJournalListener()->getToken(); // Request async I/O to the journal. This may block. journalWriter.writeBuffer(buffer, commitNumber); @@ -886,5 +893,15 @@ void startup() { DurableInterface::_impl = &durableImpl; } +void setJournalListener(JournalListener* jl) { + stdx::unique_lock<stdx::mutex> lk(journalListenerMutex); + journalListener = jl; +} + +JournalListener* getJournalListener() { + stdx::unique_lock<stdx::mutex> lk(journalListenerMutex); + return journalListener; +} + } // namespace dur } // namespace mongo |