[SERVER-33702] Move sessionId and txnNumber addition from ShardingTaskExecutor::scheduleRemoteCommand Created: 06/Mar/18  Updated: 05/Jun/18  Resolved: 17/Apr/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Misha Tyulenev Assignee: Misha Tyulenev
Resolution: Duplicate Votes: 0
Labels: PM-834, todo_in_code
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-33029 Support snapshot in cluster aggregate... Closed
Duplicate
duplicates SERVER-33991 Pass txnNumber all the getMore comman... Closed
Participants:

 Description   

Currently ShardingTaskExecutor::scheduleRemoteCommand adds sessionId to the command before its passed to shards. https://github.com/mongodb/mongo/blob/r3.7.2/src/mongo/s/sharding_task_executor.cpp#L122-L131

This is wrong place for command mutating operations. There are other better places such as
build(Un)VersionedRequestsForTargetedShards

another related issue with this code is that it does not pass the txnNumber: adding this code to sharding_task_executor

            if (request.opCtx->getTxnNumber() && !request.cmdObj.hasField("txnNumber")) {
                bob.append("txnNumber", *(request.opCtx->getTxnNumber()));
            }

breaks retryable_writes.js test https://logkeeper.mongodb.org/lobster/build/3fd956889add4ebb942a9029d1966e5c/test/5aa07efebe07c43cdf26e014?bookmarks=0%2C2203



 Comments   
Comment by Misha Tyulenev [ 10/Apr/18 ]

This should be reviewed later when commands data handling is simplified.

Comment by Randolph Tan [ 09/Mar/18 ]

Mongos shouldn't need to attach txnNumber since it is already included in the user request. The only exception for this is when mongos had to construct new request (ex. write commands has to split the request to multiple small batches to be sent to multiple shards) where it has to make sure that it includes the txnNumber.

Generated at Thu Feb 08 04:34:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.