diff options
author | Samy Lanka <samy.lanka@mongodb.com> | 2019-07-11 10:44:27 -0400 |
---|---|---|
committer | Samy Lanka <samy.lanka@mongodb.com> | 2019-08-08 11:35:32 -0400 |
commit | 77967c90b1a521108c052af235ce7de9742aa95e (patch) | |
tree | 22809f1433ab3b2b3f85359400a36a7d7f8050c4 /src/mongo/db/operation_context.h | |
parent | 321201823455e1c648b7c6bd4ae0a59d1b7115b8 (diff) | |
download | mongo-77967c90b1a521108c052af235ce7de9742aa95e.tar.gz |
SERVER-40466 Unify checks for being in a multi-document transaction
Diffstat (limited to 'src/mongo/db/operation_context.h')
-rw-r--r-- | src/mongo/db/operation_context.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h index 5723bc1dac7..26dc7a7723c 100644 --- a/src/mongo/db/operation_context.h +++ b/src/mongo/db/operation_context.h @@ -358,6 +358,22 @@ public: bool isIgnoringInterrupts() const; + /** + * Returns whether this operation is part of a multi-document transaction. Specifically, it + * indicates whether the user asked for a multi-document transaction. + */ + bool inMultiDocumentTransaction() const { + return _inMultiDocumentTransaction; + } + + /** + * Sets that this operation is part of a multi-document transaction. Once this is set, it cannot + * be unset. + */ + void setInMultiDocumentTransaction() { + _inMultiDocumentTransaction = true; + } + private: IgnoreInterruptsState pushIgnoreInterrupts() override { IgnoreInterruptsState iis{_ignoreInterrupts, @@ -482,6 +498,7 @@ private: bool _writesAreReplicated = true; bool _shouldParticipateInFlowControl = true; + bool _inMultiDocumentTransaction = false; }; namespace repl { |