fix(hstore): preserve range-index ordering across partitions - #3140
Open
contrueCT wants to merge 5 commits into
Open
fix(hstore): preserve range-index ordering across partitions#3140contrueCT wants to merge 5 commits into
contrueCT wants to merge 5 commits into
Conversation
imbajin
reviewed
Aug 6, 2026
imbajin
left a comment
Member
There was a problem hiding this comment.
Blocking: yes. Summary: The ordered range-index path has a multi-batch ordering defect and is unsafe during mixed-version Store upgrades. Evidence: static review of QueryList/QueryResults and NodeTxSessionProxy/store_stream_meta.proto at head b45fded.
imbajin
reviewed
Aug 6, 2026
imbajin
left a comment
Member
There was a problem hiding this comment.
Blocking: yes. Summary: The ordered range-index path still has correctness, cursor, resource, and compatibility defects beyond the existing review coverage. Evidence: exact-head static review of QueryResults, ScanUtil, OrderedKvIterator, OrderedMultiPartitionIterator, and public scan contracts at b45fded.
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.
Purpose of the PR
HStore range-index queries with a limit, offset, or page cursor require globally
ordered backend keys. The previous multi-partition path exposed partition
iteration order and an internal storage cursor, which could return the wrong
limited slice or skip entries on continuation.
This PR adds an explicit ordered range-scan path while leaving unbounded count,
joint-index, and cleanup scans on the existing path.
Main Changes
flowchart LR subgraph Store1["Store 1"] P1["Partition 1"] --> M1["Local K-way merge"] P2["Partition 2"] --> M1 end subgraph Store2["Store 2"] P3["Partition 3"] --> M2["Local K-way merge"] P4["Partition 4"] --> M2 end M1 --> G["Client global K-way merge"] M2 --> G G --> R["Ordered range-index results"]preserve ordered index IDs through the following element lookup.
ORDER_BY_KEYto the HStore scan protocol. Each Store merges its localleader-partition iterators, and the client globally merges one stream per
Store instead of opening one stream per partition.
is exhausted, and bound concurrent first-page initialization to eight
streams.
not explicitly select the ordered path. Client and Store nodes must be
upgraded together before using ordered range scans.
Verifying these changes
ClientSuiteTest: 13 tests passed.ServerSuiteTest: 6 tests passed.HstoreSessionsImplTestandHstoreTableTest: 8 tests passed.GraphIndexTransactionTest,IdHolderTest, andQueryResultsTest: 4 tests passed.git diff --checkpassed.Does this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No Need