diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2019-04-24 13:29:46 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2019-04-25 14:01:49 -0400 |
commit | adc119c397aecfc956e90d21b04aa5be196249c0 (patch) | |
tree | e29b53a561c998c19ebe76baf52ae154a3e9748b /src/mongo/s/transaction_router.h | |
parent | 02b0d9578f9705e7c419d5ba357b554f04687ab3 (diff) | |
download | mongo-adc119c397aecfc956e90d21b04aa5be196249c0.tar.gz |
SERVER-40666 Router should skip two phase commit if transaction only wrote to one shard
Diffstat (limited to 'src/mongo/s/transaction_router.h')
-rw-r--r-- | src/mongo/s/transaction_router.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/mongo/s/transaction_router.h b/src/mongo/s/transaction_router.h index 5f248029551..a0590d1ab02 100644 --- a/src/mongo/s/transaction_router.h +++ b/src/mongo/s/transaction_router.h @@ -230,8 +230,8 @@ public: const boost::optional<ShardId>& getCoordinatorId() const; /** - * Commits the transaction. For transactions with multiple participants, this will initiate - * the two phase commit procedure. + * Commits the transaction. For transactions that performed writes to multiple shards, this will + * hand off the participant list to the coordinator to do two-phase commit. */ BSONObj commitTransaction(OperationContext* opCtx, const boost::optional<TxnRecoveryToken>& recoveryToken); @@ -286,23 +286,15 @@ private: const LogicalSessionId& _sessionId() const; /** - * Run basic commit for transactions that touched a single shard. + * Retrieves the transaction's outcome from the shard specified in the recovery token. */ - BSONObj _commitSingleShardTransaction(OperationContext* opCtx); - - /** - * Skips explicit commit and instead waits for participants' read Timestamps to reach the level - * of durability specified by the writeConcern on 'opCtx'. - */ - BSONObj _commitReadOnlyTransaction(OperationContext* opCtx); - BSONObj _commitWithRecoveryToken(OperationContext* opCtx, const TxnRecoveryToken& recoveryToken); /** - * Run two phase commit for transactions that touched multiple shards. + * Hands off coordinating a two-phase commit across all participants to the coordinator shard. */ - BSONObj _commitMultiShardTransaction(OperationContext* opCtx); + BSONObj _handOffCommitToCoordinator(OperationContext* opCtx); /** * Sets the given logical time as the atClusterTime for the transaction to be the greater of the |