diff options
Diffstat (limited to 'src/mongo/s/transaction_router.cpp')
-rw-r--r-- | src/mongo/s/transaction_router.cpp | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/mongo/s/transaction_router.cpp b/src/mongo/s/transaction_router.cpp index c2bdc3d7f68..8bfb6cbbb39 100644 --- a/src/mongo/s/transaction_router.cpp +++ b/src/mongo/s/transaction_router.cpp @@ -41,7 +41,6 @@ #include "mongo/db/jsobj.h" #include "mongo/db/logical_clock.h" #include "mongo/db/logical_session_id.h" -#include "mongo/db/logical_session_id.h" #include "mongo/db/repl/read_concern_args.h" #include "mongo/executor/task_executor_pool.h" #include "mongo/rpc/get_status_from_command_result.h" @@ -520,17 +519,13 @@ void TransactionRouter::Router::_assertAbortStatusIsOkOrNoSuchTransaction( auto shardResponse = uassertStatusOKWithContext( std::move(response.swResponse), str::stream() << "Failed to send abort to shard " << response.shardId - << " between retries of statement " - << p().latestStmtId); + << " between retries of statement " << p().latestStmtId); auto status = getStatusFromCommandResult(shardResponse.data); uassert(ErrorCodes::NoSuchTransaction, str::stream() << txnIdToString() << "Transaction aborted between retries of statement " - << p().latestStmtId - << " due to error: " - << status - << " from shard: " - << response.shardId, + << p().latestStmtId << " due to error: " << status + << " from shard: " << response.shardId, status.isOK() || status.code() == ErrorCodes::NoSuchTransaction); // abortTransaction is sent with no write concern, so there's no need to check for a write @@ -658,8 +653,9 @@ void TransactionRouter::Router::onSnapshotError(OperationContext* opCtx, const Status& errorStatus) { invariant(canContinueOnSnapshotError()); - LOG(3) << txnIdToString() << " Clearing pending participants and resetting global snapshot " - "timestamp after snapshot error: " + LOG(3) << txnIdToString() + << " Clearing pending participants and resetting global snapshot " + "timestamp after snapshot error: " << errorStatus << ", previous timestamp: " << o().atClusterTime->getTime(); // The transaction must be restarted on all participants because a new read timestamp will be @@ -711,17 +707,14 @@ void TransactionRouter::Router::beginOrContinueTxn(OperationContext* opCtx, // This transaction is older than the transaction currently in progress, so throw an error. uasserted(ErrorCodes::TransactionTooOld, str::stream() << "txnNumber " << txnNumber << " is less than last txnNumber " - << o().txnNumber - << " seen in session " - << _sessionId()); + << o().txnNumber << " seen in session " << _sessionId()); } else if (txnNumber == o().txnNumber) { // This is the same transaction as the one in progress. switch (action) { case TransactionActions::kStart: { uasserted(ErrorCodes::ConflictingOperationInProgress, str::stream() << "txnNumber " << o().txnNumber << " for session " - << _sessionId() - << " already started"); + << _sessionId() << " already started"); } case TransactionActions::kContinue: { uassert(ErrorCodes::InvalidOptions, @@ -767,11 +760,9 @@ void TransactionRouter::Router::beginOrContinueTxn(OperationContext* opCtx, } case TransactionActions::kContinue: { uasserted(ErrorCodes::NoSuchTransaction, - str::stream() << "cannot continue txnId " << o().txnNumber - << " for session " - << _sessionId() - << " with txnId " - << txnNumber); + str::stream() + << "cannot continue txnId " << o().txnNumber << " for session " + << _sessionId() << " with txnId " << txnNumber); } case TransactionActions::kCommit: { _resetRouterState(opCtx, txnNumber); @@ -896,11 +887,10 @@ BSONObj TransactionRouter::Router::_commitTransaction( switch (participant.second.readOnly) { case Participant::ReadOnly::kUnset: uasserted(ErrorCodes::NoSuchTransaction, - str::stream() << txnIdToString() << " Failed to commit transaction " - << "because a previous statement on the transaction " - << "participant " - << participant.first - << " was unsuccessful."); + str::stream() + << txnIdToString() << " Failed to commit transaction " + << "because a previous statement on the transaction " + << "participant " << participant.first << " was unsuccessful."); case Participant::ReadOnly::kReadOnly: readOnlyShards.push_back(participant.first); break; @@ -1019,8 +1009,9 @@ void TransactionRouter::Router::implicitlyAbortTransaction(OperationContext* opC const Status& errorStatus) { if (o().commitType == CommitType::kTwoPhaseCommit || o().commitType == CommitType::kRecoverWithToken) { - LOG(3) << txnIdToString() << " Router not sending implicit abortTransaction because commit " - "may have been handed off to the coordinator"; + LOG(3) << txnIdToString() + << " Router not sending implicit abortTransaction because commit " + "may have been handed off to the coordinator"; return; } |