-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Cluster Scalability
-
Fully Compatible
-
Cluster Scalability 2024-2-19, Cluster Scalability 2024-3-4, Cluster Scalability 2024-3-18
Prevent existing participant from adding a participant while executing a retryable statement in a retryable internal txn: In this case, TransactionRouter will call uassert() with ErrorCodes::IllegalOperation.
TransactionRouter::Router::attachTxnFieldsIfNeeded() is where a router adds a new participant. This code is common to routers on mongos and on shards (mongod); thus we should only prevent the creation of a new participant when the opCtx indicates that the caller is an active transaction participant and that it is in a transaction: opCtx->isActiveTransactionParticipant() && opCtx->inMultiDocumentTransaction(). Additionally, opCtx->isRetryableWrite() indicates whether the current context is a retryable write.