[SERVER-82282] Refactor isTransactionCommand in transaction_validation.cpp to take into account commands not registered on mongos Created: 18/Oct/23  Updated: 26/Oct/23

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

Type: Bug Priority: Major - P3
Reporter: Enrico Golfieri Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: oldshardingemea
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by SERVER-81189 Transform `create` requests in sharde... Closed
Assigned Teams:
Catalog and Routing
Operating System: ALL
Participants:

 Description   

As a part of PM-3364 after SERVER-81189 the {create..} command instead of running directly against the primary will run _shardsvrCreateCollection on the primary which creates the collection.

However, in case {create...} runs a part of a transaction, the following check is perform on mongos which fails in case of _shardsvrCreateCollection due to CommandHelpers::findCommand since the command is only present on shard servers 

As a part of SERVER-81189 a simple fix was added to  force returning false in case of _shardsvrCreateCollection: https://github.com/mongodb/mongo/search?q=SERVER-82282&type=Code

There is no good reason to fail in case the command is not found since this check is already performed by the entry point . 

The helper should probably instead either:

  • return default false in case a command is not found
  • perform the check on the shard instead of mongos 
  • Any other solution that can make the code better maintainable  

Generated at Thu Feb 08 06:48:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.