mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
force commit every 100MB
This commit is contained in:
parent
7740e42328
commit
a076624f2e
11
db/dur.cpp
11
db/dur.cpp
@ -515,9 +515,18 @@ namespace mongo {
|
||||
void unlinkThread();
|
||||
void recover();
|
||||
void releasingWriteLock() {
|
||||
try {
|
||||
#if defined(_DEBUG)
|
||||
getDur().debugCheckLastDeclaredWrite();
|
||||
getDur().debugCheckLastDeclaredWrite();
|
||||
#endif
|
||||
|
||||
if (commitJob.bytes() > 100*1024*1024)
|
||||
groupCommit();
|
||||
}
|
||||
catch(std::exception& e) {
|
||||
log() << "exception in dur::releasingWriteLock causing immediate shutdown: " << e.what() << endl;
|
||||
abort(); // based on myTerminate()
|
||||
}
|
||||
}
|
||||
|
||||
/** at startup, recover, and then start the journal threads */
|
||||
|
@ -43,6 +43,7 @@ namespace mongo {
|
||||
_hasWritten = false;
|
||||
_wi.clear();
|
||||
_ab.reset();
|
||||
_bytes = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ namespace mongo {
|
||||
public:
|
||||
AlignedBuilder _ab; // for direct i/o writes to journal
|
||||
|
||||
CommitJob() : _ab(4 * 1024 * 1024) , _hasWritten(false) { }
|
||||
CommitJob() : _ab(4 * 1024 * 1024) , _hasWritten(false), _bytes(0) { }
|
||||
|
||||
/** record/note an intent to write */
|
||||
void note(WriteIntent& w);
|
||||
@ -117,10 +117,13 @@ namespace mongo {
|
||||
_notify.wait();
|
||||
}
|
||||
|
||||
size_t bytes() const { return _bytes; }
|
||||
|
||||
private:
|
||||
bool _hasWritten;
|
||||
Writes _wi;
|
||||
NotifyAll _notify;
|
||||
size_t _bytes;
|
||||
};
|
||||
extern CommitJob commitJob;
|
||||
|
||||
@ -170,8 +173,9 @@ namespace mongo {
|
||||
|
||||
// remember intent. we will journal it in a bit
|
||||
_wi._writes.push_back(w);
|
||||
_bytes += w.len;
|
||||
wassert( _wi._writes.size() < 2000000 );
|
||||
assert( _wi._writes.size() < 20000000 );
|
||||
//assert( _wi._writes.size() < 20000000 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user