-
Notifications
You must be signed in to change notification settings - Fork 4.1k
kv: merge TxnCoordSender into internal/client.DB #10511
Description
Currently, there are a bunch of hacks in TxnCoordSender with respect to contexts and cancellation. In particular, since TxnCoordSender must implement the Sender interface, it has no way of obtaining a reasonable transaction-scoped context. See https://github.com/cockroachdb/cockroach/blob/dda3ee2/pkg/kv/txn_coord_sender.go#L603:L607.
A further consequence of the above is that TxnCoordSender cannot depend on the semantic correctness of the context it is given if that context is not cancellable. See https://github.com/cockroachdb/cockroach/blob/dda3ee2/pkg/kv/txn_coord_sender.go#L729:L742.
We should hoist TxnCoordSender into the client.DB's Txn() method, which already takes a transaction-lifetime context, and remove the hacks described above in the process.
This is a pretty meaty task; good for someone looking to get acquainted with kv.
cc @andreimatei @paperstreet @bdarnell @petermattis @tschottdorf