Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kv: fix data race during retry of EndTxn after refresh
Fixes cockroachdb#103687. Fixes cockroachdb#103247. Fixes cockroachdb#104791. This commit avoids a data race between `splitEndTxnAndRetrySend` and `raceTransport` by avoiding a mutation of a shared `RequestUnion_EndTxn` object within an unshared `RequestUnion` object. The `raceTransport` makes an effort to copy the `BatchRequest`'s `RequestUnion` slice, but it does not copy the inner interface, so we can't play tricks to avoid a reallocation of the `RequestUnion_EndTxn`. The commit also addresses a similar problem in `retryTxnCommitAfterFailedParallelCommit`. We may be able to fix this in the `raceTransport`, but doing so would require some reflection magic and this is currently failing CI, so we make the easier change. Release note: None
- Loading branch information