summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.cpp
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2017-10-10 12:12:09 -0400
committerMatthew Russotto <matthew.russotto@10gen.com>2017-10-11 08:31:16 -0400
commit07b0f384cda0db602b424e8006d7400d61137a91 (patch)
tree6bfc205c3d285496a396f9bee0cf4ff669cbeacd /src/mongo/db/operation_context.cpp
parent767e041931e73ae4f7a0047114becf5be803f3ab (diff)
downloadmongo-07b0f384cda0db602b424e8006d7400d61137a91.tar.gz
SERVER-29609 Disable deadline while doing sharded postimage lookup for $changeStream.
Diffstat (limited to 'src/mongo/db/operation_context.cpp')
-rw-r--r--src/mongo/db/operation_context.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mongo/db/operation_context.cpp b/src/mongo/db/operation_context.cpp
index 848f1319ef0..75046690728 100644
--- a/src/mongo/db/operation_context.cpp
+++ b/src/mongo/db/operation_context.cpp
@@ -88,7 +88,7 @@ void OperationContext::setDeadlineAndMaxTime(Date_t when, Microseconds maxTime)
_maxTime = maxTime;
}
-void OperationContext::setDeadlineByDate(Date_t when) {
+Microseconds OperationContext::computeMaxTimeFromDeadline(Date_t when) {
Microseconds maxTime;
if (when == Date_t::max()) {
maxTime = Microseconds::max();
@@ -98,7 +98,22 @@ void OperationContext::setDeadlineByDate(Date_t when) {
maxTime = Microseconds::zero();
}
}
- setDeadlineAndMaxTime(when, maxTime);
+ return maxTime;
+}
+
+OperationContext::DeadlineStash::DeadlineStash(OperationContext* opCtx)
+ : _opCtx(opCtx), _originalDeadline(_opCtx->getDeadline()) {
+ _opCtx->_deadline = Date_t::max();
+ _opCtx->_maxTime = _opCtx->computeMaxTimeFromDeadline(Date_t::max());
+}
+
+OperationContext::DeadlineStash::~DeadlineStash() {
+ _opCtx->_deadline = _originalDeadline;
+ _opCtx->_maxTime = _opCtx->computeMaxTimeFromDeadline(_originalDeadline);
+}
+
+void OperationContext::setDeadlineByDate(Date_t when) {
+ setDeadlineAndMaxTime(when, computeMaxTimeFromDeadline(when));
}
void OperationContext::setDeadlineAfterNowBy(Microseconds maxTime) {