summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction_participant.h
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2018-09-12 14:24:53 -0400
committerSpencer T Brody <spencer@mongodb.com>2018-09-13 14:47:18 -0400
commite54a379fa19a91bd5e59752fc705d9a98e5ba453 (patch)
tree77d0ef5a88d6a92fd0b2af4e42b82273bc226f3b /src/mongo/db/transaction_participant.h
parent7c13a75b928ace3f65c9553352689dc0a6d0ca83 (diff)
downloadmongo-e54a379fa19a91bd5e59752fc705d9a98e5ba453.tar.gz
SERVER-35817 Allow shutdowns while prepared transactions are in-flight
Diffstat (limited to 'src/mongo/db/transaction_participant.h')
-rw-r--r--src/mongo/db/transaction_participant.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/transaction_participant.h b/src/mongo/db/transaction_participant.h
index 6946c1a24c0..a32b8d095d0 100644
--- a/src/mongo/db/transaction_participant.h
+++ b/src/mongo/db/transaction_participant.h
@@ -142,6 +142,16 @@ public:
static TransactionParticipant* getFromNonCheckedOutSession(Session* session);
/**
+ * Kills the transaction if it is running, ensuring that it releases all resources, even if the
+ * transaction is in prepare(). Avoids writing any oplog entries or making any changes to the
+ * transaction table. State for prepared transactions will be re-constituted at startup.
+ * Note that we don't take any active steps to prevent continued use of this
+ * TransactionParticipant after shutdown() is called, but we rely on callers to not
+ * continue using the TransactionParticipant once we are in shutdown.
+ */
+ void shutdown();
+
+ /**
* Called for speculative transactions to fix the optime of the snapshot to read from.
*/
void setSpeculativeTransactionOpTimeToLastApplied(OperationContext* opCtx);
@@ -552,6 +562,8 @@ private:
// Protects the member variables below.
mutable stdx::mutex _mutex;
+ bool _inShutdown{false};
+
// Holds transaction resources between network operations.
boost::optional<TxnResources> _txnResourceStash;