Skip to content

v25.2.28

@stevendanna stevendanna tagged this 10 Nov 21:01
Previously, if batch execution was stopped early in dist sender because
of MaxSpanRequestKeys or TargetBytes, the returned batch could have
non-Get point-requests requests that were not processed but which didn't
have a resume-span sent.

The resume span was not set since SQL does not create batches with a mix
of read and write requests with MaxSpanRequestKeys or TargetBytes set;
however, KVNemesis will soon create such batches, so we'd like to handle
them correctly. Further, setting the ResumeSpan allows the
txnWriteBuffer to double-check that all writes were processed just in
case a bug results in the write buffer producing a batch that is
partially processed.

The intent resolver does create such batches: it sends point
`ResolveIntent` requests in batches with a 4 MiB `TargetBytes`, grouped by
the range ID in the node's range cache. If the range split and the node
doesn't know about it yet, a batch can span both new ranges. When
resolving the left-hand intents uses up the budget, the right-hand
requests are never sent and used to come back without a `ResumeSpan`. The
intent resolver took that as success and garbage collected the
transaction record, so a later reader of the right-hand intents treated
the committed transaction as aborted and removed its writes.
`TestCommittedWritesSurviveSplitWithStaleRangeCache` is a regression
test for this case.

Fixes: cockroachdb/cockroach#153357
Informs: cockroachlabs/cockroach#16173

Release note (bug fix): Fixed a bug that could cause a committed
transaction to lose some of its writes. If a range split while a
transaction had writes on both sides of the split, and the node cleaning
up the transaction's intents did not yet know about the split, the writes
on the right-hand side could be left unresolved while the transaction
record was removed. A later reader then treated those writes as aborted
and removed them. With SQL this could show up as secondary index entries
without a matching primary index row, or as rows reverting to an earlier
version. The bug required values of several MiB and was present since
v23.1.0.

(cherry picked from commit beeb29ab7a66b9e705c850c41a7ec8cf4cb23359)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assets 2
Loading