diff options
Diffstat (limited to 'src/mongo/db/operation_context_session_mongod.cpp')
-rw-r--r-- | src/mongo/db/operation_context_session_mongod.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/db/operation_context_session_mongod.cpp b/src/mongo/db/operation_context_session_mongod.cpp index 39031f6cf1f..c2222d572a9 100644 --- a/src/mongo/db/operation_context_session_mongod.cpp +++ b/src/mongo/db/operation_context_session_mongod.cpp @@ -37,23 +37,24 @@ namespace mongo { -OperationContextSessionMongod::OperationContextSessionMongod(OperationContext* opCtx, - bool shouldCheckOutSession, - boost::optional<bool> autocommit, - boost::optional<bool> startTransaction, - boost::optional<bool> coordinator) +OperationContextSessionMongod::OperationContextSessionMongod( + OperationContext* opCtx, + bool shouldCheckOutSession, + const OperationSessionInfoFromClient& sessionInfo) : _operationContextSession(opCtx, shouldCheckOutSession) { if (shouldCheckOutSession && !opCtx->getClient()->isInDirectClient()) { const auto txnParticipant = TransactionParticipant::get(opCtx); const auto clientTxnNumber = *opCtx->getTxnNumber(); txnParticipant->refreshFromStorageIfNeeded(opCtx); - txnParticipant->beginOrContinue(clientTxnNumber, autocommit, startTransaction); + txnParticipant->beginOrContinue( + clientTxnNumber, sessionInfo.getAutocommit(), sessionInfo.getStartTransaction()); - if (startTransaction && *startTransaction) { + // If "startTransaction" is present, it must be true. + if (sessionInfo.getStartTransaction()) { // If this shard has been selected as the coordinator, set up the coordinator state // to be ready to receive votes. - if (coordinator && *coordinator) { + if (sessionInfo.getCoordinator() == boost::optional<bool>(true)) { createTransactionCoordinator(opCtx, clientTxnNumber); } } |