summaryrefslogtreecommitdiff
path: root/db/dur_recover.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2010-12-21 19:35:15 -0500
committerMathias Stearn <mathias@10gen.com>2010-12-21 21:23:53 -0500
commit42466ac48c2d6b88d21f79142e564645d3b30eb1 (patch)
tree56f3ee3c9163cc1510741924d65789a5da007430 /db/dur_recover.cpp
parent2e8dac2878b255770bce5ea020cf47dfd921e846 (diff)
downloadmongo-42466ac48c2d6b88d21f79142e564645d3b30eb1.tar.gz
make it possible to avoid replaying durOps
Diffstat (limited to 'db/dur_recover.cpp')
-rw-r--r--db/dur_recover.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/db/dur_recover.cpp b/db/dur_recover.cpp
index ab5c745d4c9..be580852c48 100644
--- a/db/dur_recover.cpp
+++ b/db/dur_recover.cpp
@@ -86,10 +86,11 @@ namespace mongo {
*/
class JournalSectionIterator : boost::noncopyable {
public:
- JournalSectionIterator(const void *p, unsigned len)
+ JournalSectionIterator(const void *p, unsigned len, bool doDurOps)
: _br(p, len)
, _sectHead(static_cast<const JSectHeader*>(_br.skip(sizeof(JSectHeader))))
, _lastDbName(NULL)
+ , _doDurOps(doDurOps)
{}
bool atEof() const { return _br.atEof(); }
@@ -125,7 +126,10 @@ namespace mongo {
case JEntry::OpCode_DropDb:
{
e.dbName = 0;
- e.op = DurOp::read(lenOrOpCode, _br);
+ boost::shared_ptr<DurOp> op = DurOp::read(lenOrOpCode, _br);
+ if (_doDurOps) {
+ e.op = op;
+ }
return true;
}
@@ -158,6 +162,7 @@ namespace mongo {
BufReader _br;
const JSectHeader* _sectHead;
const char *_lastDbName; // pointer into mmaped journal file
+ const bool _doDurOps;
};
@@ -242,7 +247,7 @@ namespace mongo {
memcpy(p, entry.e->srcData(), entry.e->len);
}
}
- else {
+ else if(entry.op) {
// a DurOp subclass operation
if( dump ) {
log() << " OP " << entry.op->toString() << endl;
@@ -270,11 +275,11 @@ namespace mongo {
log() << "END section" << endl;
}
- void RecoveryJob::processSection(const void *p, unsigned len) {
+ void RecoveryJob::processSection(const void *p, unsigned len, bool doDurOps) {
scoped_lock lk(_mx);
vector<ParsedJournalEntry> entries;
- JournalSectionIterator i(p, len);
+ JournalSectionIterator i(p, len, doDurOps);
if( _lastDataSyncedFromLastRun > i.seqNumber() + ExtraKeepTimeMs ) {
log() << "recover skipping application of section " << i.seqNumber() << " < lsn:" << _lastDataSyncedFromLastRun << endl;
@@ -312,7 +317,7 @@ namespace mongo {
while ( !br.atEof() ) {
JSectHeader h;
br.peek(h);
- processSection(br.skip(h.len), h.len);
+ processSection(br.skip(h.len), h.len, /*doDurOps*/true);
// ctrl c check
killCurrentOp.checkForInterrupt(false);