summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-03-07 12:09:23 -0500
committerEliot Horowitz <eliot@10gen.com>2011-03-07 12:18:43 -0500
commita14508a41e4294931b0fde802973b94f2b13bf56 (patch)
treea9b521458697b500d9624548db594e302131068a
parent3754755c30ad83c679e7a82bd2afbd3299c4ca26 (diff)
downloadmongo-a14508a41e4294931b0fde802973b94f2b13bf56.tar.gz
dur commitIfNeeded returns if it commited
-rw-r--r--db/dur.cpp4
-rw-r--r--db/dur.h7
2 files changed, 7 insertions, 4 deletions
diff --git a/db/dur.cpp b/db/dur.cpp
index 1122772b898..1a719396396 100644
--- a/db/dur.cpp
+++ b/db/dur.cpp
@@ -211,12 +211,14 @@ namespace mongo {
return p;
}
- void DurableImpl::commitIfNeeded() {
+ bool DurableImpl::commitIfNeeded() {
DEV commitJob._nSinceCommitIfNeededCall = 0;
if (commitJob.bytes() > UncommittedBytesLimit) { // should this also fire if CmdLine::DurAlwaysCommit?
stats.curr->_earlyCommits++;
groupCommit();
+ return true;
}
+ return false;
}
/** Used in _DEBUG builds to check that we didn't overwrite the last intent
diff --git a/db/dur.h b/db/dur.h
index ea8bf342b3f..a8035e4e7bc 100644
--- a/db/dur.h
+++ b/db/dur.h
@@ -96,8 +96,9 @@ namespace mongo {
(like creating an index or update with $atomic) can call this
whenever the db is in a sane state and it will prevent commits
from growing too large.
+ @return true if commited
*/
- virtual void commitIfNeeded() = 0;
+ virtual bool commitIfNeeded() = 0;
/** Declare write intent for a DiskLoc. @see DiskLoc::writing() */
inline DiskLoc& writingDiskLoc(DiskLoc& d) { return *((DiskLoc*) writingPtr(&d, sizeof(d))); }
@@ -172,7 +173,7 @@ namespace mongo {
void createdFile(string filename, unsigned long long len) { }
bool awaitCommit() { return false; }
bool commitNow() { return false; }
- void commitIfNeeded() { }
+ bool commitIfNeeded() { return false; }
void setNoJournal(void *dst, void *src, unsigned len);
void syncDataAndTruncateJournal() {}
};
@@ -185,7 +186,7 @@ namespace mongo {
void createdFile(string filename, unsigned long long len);
bool awaitCommit();
bool commitNow();
- void commitIfNeeded();
+ bool commitIfNeeded();
void setNoJournal(void *dst, void *src, unsigned len);
void syncDataAndTruncateJournal();
};