forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release-24.2: storage: fix comparison of suffixes
This is a partial backport of cockroachdb#128043. Release justification: this fixes an issue hit in a real cluster where a range key is never cleaned up. The EngineComparer has a bug when comparing bare suffixes - we call the normalization function on a slice without the sentinel byte; that function's logic is based on length so it will not function properly. We recently observed that this can cause problems when a RangeKeySet has a suffix with the (now obsolete) synthetic bit set, and the corresponding `RangeKeyUnset` is issued by a newer version and doesn't have the bit set. These suffixes are supposed to equal each other but this is not currently the case. We fix the comparator to account for this case correctly and add a more comprehensive test. On the old code, the updated test failed with: ``` Compare(0000000000000002000000010d, 000000000000000200000001010e) = 1, expected 0 ``` Fixes: None Release note: None
- Loading branch information
1 parent
a956ba3
commit 5daa9f6
Showing
2 changed files
with
190 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters