summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.cpp
diff options
context:
space:
mode:
authorMisha Tyulenev <misha@mongodb.com>2020-04-16 14:04:31 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-16 19:44:34 +0000
commitd05acff26c4c5a7fb27e9d0c7e31e4a3167fa7fe (patch)
tree35b6459635457caf5731264f3c7cac114a03f59e /src/mongo/db/operation_context.cpp
parentde18c56b913e055708310ac88cc31bef238ad66c (diff)
downloadmongo-d05acff26c4c5a7fb27e9d0c7e31e4a3167fa7fe.tar.gz
SERVER-47117 clear maxTimeMSForHedgedReads delay from the getMore on hedge reads
Diffstat (limited to 'src/mongo/db/operation_context.cpp')
-rw-r--r--src/mongo/db/operation_context.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mongo/db/operation_context.cpp b/src/mongo/db/operation_context.cpp
index 3553a4f0f64..b835682fcbd 100644
--- a/src/mongo/db/operation_context.cpp
+++ b/src/mongo/db/operation_context.cpp
@@ -181,6 +181,27 @@ Microseconds OperationContext::getRemainingMaxTimeMicros() const {
return _maxTime - getElapsedTime();
}
+void OperationContext::restoreMaxTimeMS() {
+ if (!_storedMaxTime) {
+ return;
+ }
+
+ auto maxTime = *_storedMaxTime;
+ _storedMaxTime = boost::none;
+
+ if (maxTime <= Microseconds::zero()) {
+ maxTime = Microseconds::max();
+ }
+
+ if (maxTime == Microseconds::max()) {
+ _deadline = Date_t::max();
+ } else {
+ auto clock = getServiceContext()->getFastClockSource();
+ _deadline = clock->now() + clock->getPrecision() + maxTime - _elapsedTime.elapsed();
+ }
+ _maxTime = maxTime;
+}
+
namespace {
// Helper function for checkForInterrupt fail point. Decides whether the operation currently