I just ran into the following scenario:
1) Start a transaction
2) Do an update. This targets shard A.
3) Send a find command with readPreference: secondary. This targets the secondary of shard B.
4) NotMaster is returned with a TransientTransactionError.
5) The transaction gets retried over and over again with the same behavior.
Our docs for readPreference say "Multi-document transactions that contain read operations must use read preference primary." (https://docs.mongodb.com/manual/core/read-preference/) but given the above scenario, I'm wondering if we should do better and instead have the router throw some different, non-transient error if it notices that a statement in a multi-shard transaction is sent with readConcern: secondary. Alternatively the router could always upgrade the readPreference to be primary for commands running in a transaction.