diff options
author | Matthew Russotto <matthew.russotto@10gen.com> | 2017-10-10 12:12:09 -0400 |
---|---|---|
committer | Matthew Russotto <matthew.russotto@10gen.com> | 2017-10-11 08:31:16 -0400 |
commit | 07b0f384cda0db602b424e8006d7400d61137a91 (patch) | |
tree | 6bfc205c3d285496a396f9bee0cf4ff669cbeacd /src/mongo/db/operation_context.h | |
parent | 767e041931e73ae4f7a0047114becf5be803f3ab (diff) | |
download | mongo-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.h | 28 |
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; |