diff options
author | dwight <dwight@10gen.com> | 2010-12-26 11:17:07 -0500 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2010-12-26 11:17:07 -0500 |
commit | da18488b48eb41538344e6c3cef995d2ef8b189e (patch) | |
tree | 214390b418dc00b2009bbbcfae3299d2e4fc2fae /db | |
parent | f35b33da44147deeb664eb0f2b8bcc696be5bcce (diff) | |
download | mongo-da18488b48eb41538344e6c3cef995d2ef8b189e.tar.gz |
organizing
Diffstat (limited to 'db')
-rw-r--r-- | db/dur.cpp | 10 | ||||
-rw-r--r-- | db/dur_writetodatafiles.cpp | 17 |
2 files changed, 16 insertions, 11 deletions
diff --git a/db/dur.cpp b/db/dur.cpp index eb9844d4aae..fd88f8fe487 100644 --- a/db/dur.cpp +++ b/db/dur.cpp @@ -369,17 +369,7 @@ namespace mongo { // (ok to crash after that) commitJob.notifyCommitted(); -#if 0 - // write the noted write intent entries to the data files. - // this has to come after writing to the journal, obviously... - MongoFile::markAllWritable(); // for _DEBUG. normally we don't write in a read lock WRITETODATAFILES(); - if (!dbMutex.isWriteLocked()) - MongoFile::unmarkAllWritable(); -#else - RecoveryJob::get().processSection(commitJob._ab.buf(), commitJob._ab.len(), false); - debugValidateMapsMatch(); -#endif commitJob.reset(); diff --git a/db/dur_writetodatafiles.cpp b/db/dur_writetodatafiles.cpp index 344a85d85d8..715da1a21f3 100644 --- a/db/dur_writetodatafiles.cpp +++ b/db/dur_writetodatafiles.cpp @@ -19,6 +19,7 @@ #include "pch.h" #include "dur_commitjob.h" #include "dur_stats.h" +#include "dur_recover.h" namespace mongo { namespace dur { @@ -44,7 +45,15 @@ namespace mongo { @see https://docs.google.com/drawings/edit?id=1TklsmZzm7ohIZkwgeK6rMvsdaR13KjtJYMsfLr175Zc&hl=en */ - void WRITETODATAFILES() { + + void WRITETODATAFILES_Impl1() { + RecoveryJob::get().processSection(commitJob._ab.buf(), commitJob._ab.len(), false); + } + + // the old implementation + void WRITETODATAFILES_Impl2() { + MongoFile::markAllWritable(); // for _DEBUG. normally we don't write in a read lock + /* we go backwards as what is at the end is most likely in the cpu cache. it won't be much, but we'll take it. */ for( set<WriteIntent>::const_iterator it(commitJob.writes().begin()), end(commitJob.writes().end()); it != end; ++it ){ const WriteIntent& intent = *it; @@ -53,6 +62,12 @@ namespace mongo { memcpy(intent.w_ptr, intent.start(), intent.length()); } + if (!dbMutex.isWriteLocked()) + MongoFile::unmarkAllWritable(); + } + + void WRITETODATAFILES() { + WRITETODATAFILES_Impl1(); debugValidateMapsMatch(); } |