0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

added commitIfNeeded()

This commit is contained in:
Mathias Stearn 2010-12-28 18:01:29 -05:00
parent 7d4bc0093f
commit 8937f72ef7
2 changed files with 16 additions and 0 deletions

View File

@ -193,6 +193,11 @@ namespace mongo {
return p;
}
void DurableImpl::commitIfNeeded() {
if (commitJob.bytes() > 50*1024*1024) // should this also fire if CmdLine::DurAlwaysCommit?
groupCommit();
}
/** Used in _DEBUG builds to check that we didn't overwrite the last intent
that was declared. called just before writelock release. we check a few
bytes after the declared region to see if they changed.

View File

@ -75,6 +75,15 @@ namespace mongo {
*/
virtual bool commitNow() = 0;
/** Commit if enough bytes have been modified. Current threshold is 50MB
The idea is that long running write operations that dont yield
(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.
*/
virtual void commitIfNeeded() = 0;
#if defined(_DEBUG)
virtual void debugCheckLastDeclaredWrite() = 0;
#endif
@ -145,6 +154,7 @@ namespace mongo {
void droppingDb(string db) { }
bool awaitCommit() { return false; }
bool commitNow() { return false; }
void commitIfNeeded() { }
#if defined(_DEBUG)
void debugCheckLastDeclaredWrite() {}
#endif
@ -159,6 +169,7 @@ namespace mongo {
void droppingDb(string db);
bool awaitCommit();
bool commitNow();
void commitIfNeeded();
#if defined(_DEBUG)
void debugCheckLastDeclaredWrite();
#endif