staging-v25.2.13: release-25.2: keys: handle case where keys targeted by GC request straddle header#163773
Conversation
As we've seen in cockroachdb#162085, it's possible for the MVCC GC queue to construct GC requests where the keys being targeted do not fall within the request header bounds. While we should never be constructing such requests, we'll introduce some defence in depth checks in a later commit. This test will evolve as we do that. Epic: none Release note: None
As we saw in cockroachdb#162085, it is possible for the MVCC GC queue to target keys outside of the request headers bound. To guard against this bug, we add special case handling when determining the span touched by a request. This should result in a RangeKeyMismatchError when such erroneous requests are constructed by the GC queue, as opposed to letting requests that may silently lead to data loss through. Epic: none Release note: None
The need for doing so was evidenced by the failure of TestMVCCGCQueueTransactionTable. These are tricky, as they can't be addressed in the global key map. By extension, they can't be checked against a replica's key bounds to see if we've routed them to the right place or not. Trying to address them returns an error, so we explicitly need to skip them in extendRangeForGCRequest. Instead, they need to be handled during GC command evaluation time. We already do this for point keys; we don't for clear ranges, and I think that's a bug we need to first prove and then fix -- see the TODO as part of this commit. Epic: none Release note: None
|
Thanks for opening a backport. Before merging, please confirm that it falls into one of the following categories (select one):
Add a brief release justification to the PR description explaining your selection. Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy. All backports must be reviewed by the TL and EM for the owning area. |
|
✅ PR #163773 is compliant with backport policy Confidence: high ❌ ENGREQ Check Failed: Please check one of the backport category checkboxes. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Backport 3/3 commits from #163450.
/cc @cockroachdb/release
Backport 3/3 commits from #162271 (on behalf of @arulajmani).
/cc @cockroachdb/kv
Individual commits:
Release justification: bug fix for potential data loss via incorrect GC requests.
Release note: Fixes a rare bug where a racing split and GC request could result in the GC of data on the post-split RHS. This could, in rare cases, lead to lost writes on the RHS.
Made with Cursor
Release justification: