diff options
author | Eric Milkie <milkie@10gen.com> | 2014-09-12 12:27:19 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2014-09-12 16:48:33 -0400 |
commit | f7a403b6ef67f6870adde252cf2dd794e8c1604b (patch) | |
tree | 54f3c89489828ae7735e7dac0b909eb01d2c5eff /src/mongo/db/repl/bgsync.cpp | |
parent | e079496c239748c95136458c85c23478ee609fdb (diff) | |
download | mongo-f7a403b6ef67f6870adde252cf2dd794e8c1604b.tar.gz |
SERVER-15089 remove fatal state and refactor rollback to use replcoord
Diffstat (limited to 'src/mongo/db/repl/bgsync.cpp')
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 1a941483984..ad88882040d 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -42,6 +42,7 @@ #include "mongo/db/repl/repl_coordinator_global.h" #include "mongo/db/repl/repl_coordinator_impl.h" #include "mongo/db/repl/rs.h" +#include "mongo/db/repl/rs_rollback.h" #include "mongo/db/repl/rs_sync.h" #include "mongo/db/repl/rslog.h" #include "mongo/db/stats/timer_stats.h" @@ -169,7 +170,7 @@ namespace repl { return; } - if (state.fatal() || state.startup()) { + if (state.startup()) { sleepsecs(5); return; } @@ -240,7 +241,7 @@ namespace repl { return; } - if (isRollbackRequired(txn, r)) { + if (_rollbackIfNeeded(txn, r)) { stop(); return; } @@ -517,7 +518,7 @@ namespace repl { } - bool BackgroundSync::isRollbackRequired(OperationContext* txn, OplogReader& r) { + bool BackgroundSync::_rollbackIfNeeded(OperationContext* txn, OplogReader& r) { string hn = r.conn()->getServerAddress(); if (!r.more()) { @@ -532,7 +533,7 @@ namespace repl { if (theirTS < _lastOpTimeFetched) { log() << "replSet we are ahead of the sync source, will try to roll back" << rsLog; - theReplSet->syncRollback(txn, r); + syncRollback(txn, theReplSet->lastOpTimeWritten, &r, _replCoord); return true; } /* we're not ahead? maybe our new query got fresher data. best to come back and try again */ @@ -552,7 +553,7 @@ namespace repl { if( ts != _lastOpTimeFetched || h != _lastH ) { log() << "replSet our last op time fetched: " << _lastOpTimeFetched.toStringPretty() << rsLog; log() << "replset source's GTE: " << ts.toStringPretty() << rsLog; - theReplSet->syncRollback(txn, r); + syncRollback(txn, theReplSet->lastOpTimeWritten, &r, _replCoord); return true; } |