diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/repl/rs_rollback.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/repl/rs_sync.cpp | 5 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index 8c8e89c20c6..a94e4603f60 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -68,7 +68,12 @@ namespace mongo { class rsfatal : public std::exception { public: - virtual const char* what() const throw() { return "replica set fatal exception"; } + rsfatal(const char* m = "replica set fatal exception") { + msg = m; + } + virtual const char* what() const throw() { return msg; } + private: + const char *msg; }; struct DocID { @@ -230,7 +235,7 @@ namespace mongo { log() << "replSet info rollback diff in end of log times: " << diff << " seconds" << rsLog; if( diff > 1800 ) { log() << "replSet rollback too long a time period for a rollback." << rsLog; - throw "error not willing to roll back more than 30 minutes of data"; + throw rsfatal("rollback error: not willing to roll back more than 30 minutes of data"); } } @@ -641,7 +646,8 @@ namespace mongo { sethbmsg(string("rollback 2 error ") + p); return 10; } - catch( rsfatal& ) { + catch( rsfatal& e ) { + sethbmsg(string(e.what())); _fatal(); return 2; } diff --git a/src/mongo/db/repl/rs_sync.cpp b/src/mongo/db/repl/rs_sync.cpp index f1c531b1c7d..5ea66deef5b 100644 --- a/src/mongo/db/repl/rs_sync.cpp +++ b/src/mongo/db/repl/rs_sync.cpp @@ -587,8 +587,9 @@ namespace replset { lock rsLock( this ); Lock::GlobalWrite writeLock; - // make sure we're not primary, secondary, or fatal already - if (box.getState().primary() || box.getState().secondary() || box.getState().fatal()) { + // make sure we're not primary, secondary, rollback, or fatal already + if (box.getState().primary() || box.getState().secondary() || + box.getState().rollback() || box.getState().fatal()) { return false; } |