Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-33702

Move sessionId and txnNumber addition from ShardingTaskExecutor::scheduleRemoteCommand

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding

      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

            Assignee:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Reporter:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: