diff options
author | Misha Tyulenev <misha@mongodb.com> | 2017-05-05 14:00:51 -0400 |
---|---|---|
committer | Misha Tyulenev <misha@mongodb.com> | 2017-05-05 14:01:58 -0400 |
commit | ffeca900972e305396f537c5b3b27e126e6746f9 (patch) | |
tree | d85e6d2cc58e25535b59b8d2ffb782bca335b68d | |
parent | 62ecb7bc5294461244bc07995ac6d113d582bc84 (diff) | |
download | mongo-ffeca900972e305396f537c5b3b27e126e6746f9.tar.gz |
SERVER-29016: make ShardRegistry::reload interruptible
(cherry picked from commit 17807063eab1387023719e818c266dd31d16a0d0)
-rw-r--r-- | src/mongo/s/client/shard_registry.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp index 2b46213ec6b..0b702bd3e0d 100644 --- a/src/mongo/s/client/shard_registry.cpp +++ b/src/mongo/s/client/shard_registry.cpp @@ -261,7 +261,11 @@ bool ShardRegistry::reload(OperationContext* txn) { // simultaneously because there is no good way to determine which of the threads has the // more recent version of the data. do { - _inReloadCV.wait(reloadLock); + auto waitStatus = txn->waitForConditionOrInterruptNoAssert(_inReloadCV, reloadLock); + if (!waitStatus.isOK()) { + LOG(1) << "ShardRegistry reload is interrupted due to: " << redact(waitStatus); + return false; + } } while (_reloadState == ReloadState::Reloading); if (_reloadState == ReloadState::Idle) { @@ -284,7 +288,6 @@ bool ShardRegistry::reload(OperationContext* txn) { _inReloadCV.notify_all(); }); - ShardRegistryData currData(txn, _shardFactory.get()); currData.addConfigShard(_data.getConfigShard()); _data.swap(currData); |