Repository navigation
fix(bigtable): avoid emitting empty open range (K, K\0) in RowSetUtil - #15013
Open
igorbernstein2 wants to merge 4 commits into
Open
igorbernstein2 wants to merge 4 commits into
igorbernstein2 wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a helper method isEmptyOpenRange to identify empty open ranges of the form (key, key\u0000) and uses it to correctly exclude or skip these ranges during truncation, splitting, and sharding in RowSetUtil. It also adds corresponding unit tests. A review comment suggests optimizing isEmptyOpenRange to avoid object allocations in hot paths by checking the size, prefix, and trailing byte directly instead of using concat.
igorbernstein2
force-pushed
the
fix-rowsetutil-empty-open-range
branch
from
November 16, 2026 16:46
a2c0fa9 to
5f1b315
Compare
mutianf
approved these changes
Nov 16, 2026
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In unsigned lexicographical byte order,
K\0(K.concat(ByteString.copyFrom(new byte[] {0}))) is the immediate successor ofK, so:(Krepresents the exact same lower bound as a closed start bound[K\0.K]represents the exact same exclusive upper bound as an open end boundK\0).Previously,
RowSetUtil.StartPointandRowSetUtil.EndPointcompared(value, isClosed)as tuples without normalizing discreteByteStringbounds, causingtruncateRange,eraseLargeRow, andshardto emit empty open ranges(K, K\0)which the Cloud Bigtable server rejects with a non-retryableINVALID_ARGUMENT: Error in field 'row_ranges' : start_key must be less than end_key.Changes
effectiveKeyonStartPointandeffectiveLimitonEndPoint) and addedisAtOrAfter/isBeforeOrAtbound predicates.eraseLargeRowto reusetruncateRange(removing the duplicatesplitOnLargeRowKeyimplementation) and updatedtruncateRangeandshardto useStartPointandEndPointpredicates consistently.RowSetUtil.shardto buffer split remainders persplitPointbefore prepending them back toranges, preventing an earlybreakwhen sharding overlapping ranges.RowSetUtilTestcoveringeraseLargeRow,erase(forward and reverse), andshardfor(K, K\0)boundary and overlapping range cases.