diff options
author | Kruti Shah <kruti139@gmail.com> | 2022-08-17 19:05:04 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-17 20:46:55 +0000 |
commit | 56f8d207426ff9bcce91f70be65b020305075fee (patch) | |
tree | 64d85b71f22bc3cc9183aaec16855339179f6801 /src/mongo/s | |
parent | 5f8f59cd20901e9de9edb5eb5f33ea72f1fc1ef7 (diff) | |
download | mongo-56f8d207426ff9bcce91f70be65b020305075fee.tar.gz |
SERVER-67748 added the additional participant parameter
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/transaction_router.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/s/transaction_router.cpp b/src/mongo/s/transaction_router.cpp index 62f5da00cf2..9a0412e0df9 100644 --- a/src/mongo/s/transaction_router.cpp +++ b/src/mongo/s/transaction_router.cpp @@ -565,6 +565,23 @@ void TransactionRouter::Router::processParticipantResponse(OperationContext* opC p().recoveryShardId = shardId; } } + + const std::string extraParticipants = "additionalParticipants"; + if (responseObj.hasField(extraParticipants)) { + BSONForEach(e, responseObj.getField(extraParticipants).Array()) { + mongo::ShardId addingparticipant = ShardId( + std::string(e.Obj().getField(StringData{"shardId"}).checkAndGetStringData())); + auto txnPart = _createParticipant(opCtx, addingparticipant); + _setReadOnlyForParticipant( + opCtx, addingparticipant, Participant::ReadOnly::kNotReadOnly); + + if (!p().isRecoveringCommit) { + // Don't update participant stats during recovery since the participant list isn't + // known. + RouterTransactionsMetrics::get(opCtx)->incrementTotalContactedParticipants(); + } + } + } } LogicalTime TransactionRouter::AtClusterTime::getTime() const { |