diff options
author | Jason Carey <jcarey@argv.me> | 2019-02-27 13:40:18 -0500 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2019-03-05 10:05:45 -0500 |
commit | 32a067938731d184b271ba3d7f43ca6727e3109c (patch) | |
tree | 759f22c263da841521a1653701a94e4b7c05c8f0 /src/mongo/db/operation_context.h | |
parent | 602bfb9c52b2274d55492f73eeac8513d9048d10 (diff) | |
download | mongo-32a067938731d184b271ba3d7f43ca6727e3109c.tar.gz |
SERVER-39427 Modify interrupt semantics for opCtx
* rename opCtx->runWithoutInterruption to
runWithoutInterruptionExceptAtGlobalShutdown
* add a opCtx->setIsExecutingShutdown method which makes the op immune
to all forms of interruption, including global shutdown
This clarifies what opCtx->runWithoutInterruption actually did and
offers an escape hatch that turns off interruption at process exit for
the thread doing cleanup.
Diffstat (limited to 'src/mongo/db/operation_context.h')
-rw-r--r-- | src/mongo/db/operation_context.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h index d6c8ea59a5d..56a363aab3e 100644 --- a/src/mongo/db/operation_context.h +++ b/src/mongo/db/operation_context.h @@ -239,6 +239,17 @@ public: void markKillOnClientDisconnect(); /** + * Identifies the opCtx as an operation which is executing global shutdown. This has the effect + * of masking any existing time limits, removing markKill-ability and is slightly stronger than + * code run under runWithoutInterruptionExceptAtGlobalShutdown, because it is also immune to + * global shutdown. + * + * This should only be called from the registered task of global shutdown and is not + * recoverable. + */ + void setIsExecutingShutdown(); + + /** * Marks this operation as killed so that subsequent calls to checkForInterrupt and * checkForInterruptNoAssert by the thread executing the operation will start returning the * specified error code. @@ -466,6 +477,7 @@ private: bool _hasArtificialDeadline = false; bool _markKillOnClientDisconnect = false; Date_t _lastClientCheck; + bool _isExecutingShutdown = false; // Max operation time requested by the user or by the cursor in the case of a getMore with no // user-specified maxTime. This is tracked with microsecond granularity for the purpose of |