summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.h
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@mongodb.com>2019-12-31 20:19:14 +0000
committerevergreen <evergreen@mongodb.com>2019-12-31 20:19:14 +0000
commitaa7260c8f699c3c691f836bf2286606b2a8eac93 (patch)
treecaf6ea5e64c1e7e74c05b13bfa2501d914de250f /src/mongo/db/operation_context.h
parentdfc7fff94015eceac518170585fce0fe112619ad (diff)
downloadmongo-aa7260c8f699c3c691f836bf2286606b2a8eac93.tar.gz
SERVER-44167 Added ability to kill operations by key
There are two patches here really. One of which makes killOp fast to use and visible. The other adds OperationKey to various places and maps it to an internal OpId.
Diffstat (limited to 'src/mongo/db/operation_context.h')
-rw-r--r--src/mongo/db/operation_context.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h
index 8fc158a7b81..c1e224bfee7 100644
--- a/src/mongo/db/operation_context.h
+++ b/src/mongo/db/operation_context.h
@@ -79,7 +79,7 @@ class OperationContext : public Interruptible, public Decorable<OperationContext
OperationContext& operator=(const OperationContext&) = delete;
public:
- OperationContext(Client* client, unsigned int opId);
+ OperationContext(Client* client, OperationId opId);
virtual ~OperationContext();
bool shouldParticipateInFlowControl() const {
@@ -166,11 +166,25 @@ public:
/**
* Returns the operation ID associated with this operation.
*/
- unsigned int getOpID() const {
+ OperationId getOpID() const {
return _opId;
}
/**
+ * Returns the operation UUID associated with this operation or boost::none.
+ */
+ const boost::optional<OperationKey>& getOperationKey() const {
+ return _opKey;
+ }
+
+ /**
+ * Sets the operation UUID associated with this operation.
+ *
+ * This function may only be called once per OperationContext.
+ */
+ void setOperationKey(OperationKey opKey);
+
+ /**
* Returns the session ID associated with this operation, if there is one.
*/
const boost::optional<LogicalSessionId>& getLogicalSessionId() const {
@@ -490,7 +504,8 @@ private:
Client* const _client;
- const unsigned int _opId;
+ const OperationId _opId;
+ boost::optional<OperationKey> _opKey;
boost::optional<LogicalSessionId> _lsid;
boost::optional<TxnNumber> _txnNumber;