diff options
author | Benety Goh <benety@mongodb.com> | 2016-11-12 15:29:47 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2016-11-14 11:20:51 -0500 |
commit | f584ed50bc34db9ad0ac5fb79ecd6e1fe8ff88eb (patch) | |
tree | fbd39a56d54fa69cf394a6abef4c3a3ecdd6fdca /src/mongo/db/repl/sync_source_resolver.cpp | |
parent | 508aae2223da2390b7b22c9d04d7707af7e131a8 (diff) | |
download | mongo-f584ed50bc34db9ad0ac5fb79ecd6e1fe8ff88eb.tar.gz |
SERVER-27011 SyncSourceResolver::startup() should return ShutdownInProgress if shutting down
Diffstat (limited to 'src/mongo/db/repl/sync_source_resolver.cpp')
-rw-r--r-- | src/mongo/db/repl/sync_source_resolver.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/db/repl/sync_source_resolver.cpp b/src/mongo/db/repl/sync_source_resolver.cpp index 3d63256b655..dced97cef3a 100644 --- a/src/mongo/db/repl/sync_source_resolver.cpp +++ b/src/mongo/db/repl/sync_source_resolver.cpp @@ -94,10 +94,17 @@ bool SyncSourceResolver::_isActive_inlock() const { Status SyncSourceResolver::startup() { { stdx::lock_guard<stdx::mutex> lock(_mutex); - if (State::kPreStart != _state) { - return Status(ErrorCodes::IllegalOperation, "sync source resolver already started"); + switch (_state) { + case State::kPreStart: + _state = State::kRunning; + break; + case State::kRunning: + return Status(ErrorCodes::IllegalOperation, "sync source resolver already started"); + case State::kShuttingDown: + return Status(ErrorCodes::ShutdownInProgress, "sync source resolver shutting down"); + case State::kComplete: + return Status(ErrorCodes::ShutdownInProgress, "sync source resolver completed"); } - _state = State::kRunning; } return _chooseAndProbeNextSyncSource(OpTime()); |