Skip to content

kv: merge TxnCoordSender into internal/client.DB #10511

@tamird

Description

@tamird

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

Metadata

Metadata

Assignees

Labels

C-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.E-intermediateIntermediate complexity, needs a contributor with 3-6 months of past contribution experience.help wantedHelp is requested / needed by the one who filed the issue to fix it.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions