summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Tyulenev <misha@mongodb.com>2017-04-28 15:54:52 -0400
committerMisha Tyulenev <misha@mongodb.com>2017-04-28 15:55:07 -0400
commit17807063eab1387023719e818c266dd31d16a0d0 (patch)
treec8fc4cc753432cc4614e70063a0fd262e833ca56
parent377281fd326ece7cb48675662f34b9148b40e000 (diff)
downloadmongo-17807063eab1387023719e818c266dd31d16a0d0.tar.gz
SERVER-29016: make ShardRegistry::reload interruptible
-rw-r--r--src/mongo/s/client/shard_registry.cpp7
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 623801dd756..dd14458ad95 100644
--- a/src/mongo/s/client/shard_registry.cpp
+++ b/src/mongo/s/client/shard_registry.cpp
@@ -267,7 +267,11 @@ bool ShardRegistry::reload(OperationContext* opCtx) {
// 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 = opCtx->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) {
@@ -290,7 +294,6 @@ bool ShardRegistry::reload(OperationContext* opCtx) {
_inReloadCV.notify_all();
});
-
ShardRegistryData currData(opCtx, _shardFactory.get());
currData.addConfigShard(_data.getConfigShard());
_data.swap(currData);