summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/s/balancer/balancer.cpp5
-rw-r--r--src/mongo/db/s/balancer/balancer.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp
index 36987fb81ec..7e334b8b86e 100644
--- a/src/mongo/db/s/balancer/balancer.cpp
+++ b/src/mongo/db/s/balancer/balancer.cpp
@@ -243,8 +243,9 @@ void Balancer::waitForBalancerToStop() {
void Balancer::joinCurrentRound(OperationContext* opCtx) {
stdx::unique_lock<stdx::mutex> scopedLock(_mutex);
const auto numRoundsAtStart = _numBalancerRounds;
- _condVar.wait(scopedLock,
- [&] { return !_inBalancerRound || _numBalancerRounds != numRoundsAtStart; });
+ opCtx->waitForConditionOrInterrupt(_condVar, scopedLock, [&] {
+ return !_inBalancerRound || _numBalancerRounds != numRoundsAtStart;
+ });
}
Status Balancer::rebalanceSingleChunk(OperationContext* opCtx, const ChunkType& chunk) {
diff --git a/src/mongo/db/s/balancer/balancer.h b/src/mongo/db/s/balancer/balancer.h
index d8847a4ee90..7f601a849e2 100644
--- a/src/mongo/db/s/balancer/balancer.h
+++ b/src/mongo/db/s/balancer/balancer.h
@@ -110,7 +110,8 @@ public:
/**
* Potentially blocking method, which will return immediately if the balancer is not running a
- * balancer round and will block until the current round completes otherwise.
+ * balancer round and will block until the current round completes otherwise. If the operation
+ * context's deadline is exceeded, it will throw an ExceededTimeLimit exception.
*/
void joinCurrentRound(OperationContext* txn);