summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.h
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.h
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.h')
-rw-r--r--src/mongo/db/operation_context.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h
index 6b2e28be20d..5f1cbec5954 100644
--- a/src/mongo/db/operation_context.h
+++ b/src/mongo/db/operation_context.h
@@ -84,6 +84,28 @@ public:
kFailedUnitOfWork // in a unit of work that has failed and must be aborted
};
+ /**
+ * An RAII type that will temporarily suspend any deadline on this operation. Resets the
+ * deadline to the previous value upon destruction.
+ */
+ class DeadlineStash {
+ public:
+ /**
+ * Clears any deadline set on this operation.
+ */
+ DeadlineStash(OperationContext* opCtx);
+
+ /**
+ * Resets the deadline on '_opCtx' to the original deadline present at the time this
+ * DeadlineStash was constructed.
+ */
+ ~DeadlineStash();
+
+ private:
+ OperationContext* _opCtx;
+ Date_t _originalDeadline;
+ };
+
OperationContext(Client* client, unsigned int opId);
virtual ~OperationContext() = default;
@@ -412,6 +434,11 @@ private:
void setDeadlineAndMaxTime(Date_t when, Microseconds maxTime);
/**
+ * Compute maxTime based on the given deadline.
+ */
+ Microseconds computeMaxTimeFromDeadline(Date_t when);
+
+ /**
* Returns the timepoint that is "waitFor" ms after now according to the
* ServiceContext's precise clock.
*/
@@ -424,6 +451,7 @@ private:
_writesAreReplicated = writesAreReplicated;
}
+ friend class DeadlineStash;
friend class WriteUnitOfWork;
friend class repl::UnreplicatedWritesBlock;
Client* const _client;