diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-09-14 17:08:06 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-09-14 17:08:06 +0200 |
commit | 5d342a758c6095b4d30aba0750b54f13b8916f51 (patch) | |
tree | 762e9aa84781f5e3b96db2c02d356c29cf0217c0 /db/dur_commitjob.h | |
parent | cbe2d992e9cd1ea66af9fa91df006106775d3073 (diff) | |
download | mongodb-5d342a758c6095b4d30aba0750b54f13b8916f51.tar.gz |
Imported Upstream version 2.0.0
Diffstat (limited to 'db/dur_commitjob.h')
-rw-r--r-- | db/dur_commitjob.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/db/dur_commitjob.h b/db/dur_commitjob.h index 104d054..a5f8515 100644 --- a/db/dur_commitjob.h +++ b/db/dur_commitjob.h @@ -38,8 +38,8 @@ namespace mongo { * since that is heavily used in set lookup. */ struct WriteIntent { /* copyable */ - WriteIntent() : w_ptr(0), p(0) { } - WriteIntent(void *a, unsigned b) : w_ptr(0), p((char*)a+b), len(b) { } + WriteIntent() : /*w_ptr(0), */ p(0) { } + WriteIntent(void *a, unsigned b) : /*w_ptr(0), */ p((char*)a+b), len(b) { } void* start() const { return (char*)p - len; } void* end() const { return p; } @@ -64,7 +64,7 @@ namespace mongo { return (out << "p: " << wi.p << " end: " << wi.end() << " len: " << wi.len); } - mutable void *w_ptr; // writable mapping of p. + //mutable void *w_ptr; // writable mapping of p. // mutable because set::iterator is const but this isn't used in op< #if defined(_EXPERIMENTAL) mutable unsigned ofsInJournalBuffer; @@ -189,14 +189,10 @@ namespace mongo { /** we use the commitjob object over and over, calling reset() rather than reconstructing */ void reset(); - /** the commit code calls this when data reaches the journal (on disk) */ - void notifyCommitted() { _notify.notifyAll(); } + void beginCommit(); - /** Wait until the next group commit occurs. That is, wait until someone calls notifyCommitted. */ - void awaitNextCommit() { - if( hasWritten() ) - _notify.wait(); - } + /** the commit code calls this when data reaches the journal (on disk) */ + void notifyCommitted() { _notify.notifyAll(_commitNumber); } /** we check how much written and if it is getting to be a lot, we commit sooner. */ size_t bytes() const { return _bytes; } @@ -207,11 +203,12 @@ namespace mongo { Writes& wi() { return _wi; } private: + NotifyAll::When _commitNumber; bool _hasWritten; Writes _wi; // todo: fix name size_t _bytes; - NotifyAll _notify; // for getlasterror fsync:true acknowledgements public: + NotifyAll _notify; // for getlasterror fsync:true acknowledgements unsigned _nSinceCommitIfNeededCall; }; |