The transaction router's current implementation for identifying transaction commands (such as commit or abort) is flawed. The router uses an isTransactionCommand helper function that checks if a command is a transaction command by looking it up in its local registry. It throws CommandNotFound in case not found.
This approach has two main problems:
- It assumes that any command that runs as part of a transaction (such as create or insert) must be known by the router itself
- It assumes that no conclusion can be made on a command not found locally
Regarding the first point, the proper verification is already performed at the entry point of each node when a command is received. A router should not assume a command's non-existence simply because it's not registered internally.
As for the second point, we can safely assume that transaction-specific commands (commit, abort, etc.) are always registered in the router, which acts as the transaction coordinator. Therefore, any command not found can be treated as a regular command.
This ticket aims to assess the feasibility of eliminating the exception and instead treating all unregistered commands as regular commands by default.
- is caused by
-
SERVER-81189 Transform `create` requests in sharded cluster to `_shardSvrCreateCollection`
- Closed