summaryrefslogtreecommitdiff
path: root/src/mongo/s/transaction_router.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2018-12-12 17:58:38 -0500
committerRandolph Tan <randolph@10gen.com>2019-02-28 17:33:31 -0500
commitc5f474e0728ab6cd75e23ce9f343cc20ac3c1f14 (patch)
tree586ef9a1da73625f4ac817900bd2abca647e0a9c /src/mongo/s/transaction_router.cpp
parent78d82f7dab0efcf651535665703ae1f80e759605 (diff)
downloadmongo-c5f474e0728ab6cd75e23ce9f343cc20ac3c1f14.tar.gz
SERVER-37972 Create suite for running multi shard jscore with sharded transactions with kill
Diffstat (limited to 'src/mongo/s/transaction_router.cpp')
-rw-r--r--src/mongo/s/transaction_router.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/mongo/s/transaction_router.cpp b/src/mongo/s/transaction_router.cpp
index 0975508bfa9..51ca27d08b1 100644
--- a/src/mongo/s/transaction_router.cpp
+++ b/src/mongo/s/transaction_router.cpp
@@ -613,17 +613,23 @@ Shard::CommandResponse TransactionRouter::_commitMultiShardTransaction(Operation
coordinatorShard = Grid::get(opCtx)->shardRegistry()->getConfigShard();
if (!_initiatedTwoPhaseCommit) {
+ SharedTransactionOptions options;
+ options.txnNumber = _txnNumber;
+ // Intentionally leave atClusterTime blank since we don't care and to minimize
+ // possibility that storage engine won't have it available.
+ Participant configParticipant(true, 0, options);
+
// Send a fake transaction statement to the config server primary so that the config
// server primary sets up state in memory to receive coordinateCommit.
auto cmdResponse = coordinatorShard->runCommandWithFixedRetryAttempts(
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
"dummy",
- coordinatorIter->second.attachTxnFieldsIfNeeded(BSON("distinct"
- << "dummy"
- << "key"
- << "dummy"),
- true),
+ configParticipant.attachTxnFieldsIfNeeded(BSON("distinct"
+ << "dummy"
+ << "key"
+ << "dummy"),
+ true),
Shard::RetryPolicy::kIdempotent);
uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(cmdResponse));
@@ -633,8 +639,7 @@ Shard::CommandResponse TransactionRouter::_commitMultiShardTransaction(Operation
opCtx,
ReadPreferenceSetting{ReadPreference::PrimaryOnly},
"admin",
- coordinatorIter->second.attachTxnFieldsIfNeeded(BSON("abortTransaction" << 1),
- false),
+ configParticipant.attachTxnFieldsIfNeeded(BSON("abortTransaction" << 1), false),
Shard::RetryPolicy::kIdempotent);
uassertStatusOK(Shard::CommandResponse::getEffectiveStatus(cmdResponse));
}