Repository navigation
fix: respect namespace ordering in multi-shard Get and List - #434
Draft
void-ptr974 wants to merge 1 commit into
Draft
void-ptr974 wants to merge 1 commit into
void-ptr974 wants to merge 1 commit into
Conversation
Read the namespace key_sorting metadata and use one ordering snapshot for primary-key nearest reads and global lists. Match the server's UTF-8 storage encodings while retaining the legacy order for old servers and secondary-index merges. Cover metadata-only assignment updates, encoded-key boundaries, Unicode ordering, async shard merges and secondary-index isolation.
void-ptr974
requested review from
RobertIndie,
mattisonchao and
merlimat
as code owners
October 6, 2026 04:27
void-ptr974
marked this pull request as draft
October 6, 2026 05:07
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.
Cross-shard primary-key Get and List must merge results in the namespace's key order. The Java schema omitted the server's
key_sortingfield, so these merges always used the legacyCompareWithSlashorder, producing incorrect Get results and List ordering.Examples
Each example contains exactly three stored keys on different shards. Names omit the common
random-probe:prefix. In the order lines below, brackets mark query keys that are not stored.Natural order compares unsigned UTF-8 bytes:
Hierarchical order compares slash depth first, then encoded bytes. The
p0/...records have depth one;da//zhas depth two:For these absent queries, FLOOR/LOWER selects the immediately preceding stored key; CEILING/HIGHER selects the immediately following one. List should follow the stored-key order.
da10)da//zda1p0/k06)da//zp0/k07xx//a)p0/k07da//z[da1, db, da//z][da//z, da1, db][da//z, p0/k05, p0/k07][p0/k05, p0/k07, da//z]Fix and Go alignment
Add
key_sortingto the Java schema and use comparators matching the server's key encodings. Metadata updates refresh the comparator, including when shard placement is unchanged. Each asynchronous merge captures one comparator.Absent/unknown metadata and secondary-index queries continue using the legacy comparator. Its supplementary-Unicode comparison is corrected to use UTF-8 bytes instead of UTF-16 code units, matching Go.
Primary-key comparison Get now follows the tested Go client's ordering. Java List agrees with Go RangeScan, used by the Go CLI's
client list. Go SDK List does not globally sort shard results. Full secondary-index nearest-key parity is outside this PR.Validation
client:spotlessCheckandclient:spotbugsMainpassed.