diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-10-17 11:16:45 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-10-18 12:01:51 -0400 |
commit | 078f28920cb24de0dd479b5ea6c66c644f6326e9 (patch) | |
tree | 7dd73c1137a9b8d3baffa3bc2c585a3cc8f4722e | |
parent | 998863e3f1af804063a2f6a0c1633b6df40a3350 (diff) | |
download | mongo-r3.4.10.tar.gz |
SERVER-31091 Make Balancer::joinCurrentRound obey the OperationContext deadliner3.4.10-rc0r3.4.10
(cherry picked from commit 689e308e910b1c689246da34ac85ca0198f68e4a)
-rw-r--r-- | src/mongo/db/s/balancer/balancer.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/s/balancer/balancer.h | 3 |
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); |