Repository navigation
raw: stop scanning at the end of the keyspace - #569
ti-chi-bot[bot] merged 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Scans stop after the final region without an extra request. No merge-blocking risk is established. Pre-merge checks |
|
86dfa2f to
983ba67
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new termination behavior needs regression coverage for under-limit forward and reverse scans.
1 open finding
What changed in this PR
Stops RawKV scans after processing the final TiKV region, preventing repeated scans at the keyspace boundary.
Changes:
- Detects an empty next-region key and terminates forward or reverse scans.
| File | Description |
|---|---|
src/raw/client.rs |
Stops scanning when the final region is reached. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
983ba67 to
51b4bf0
Compare
51b4bf0 to
b0e351e
Compare
For an API v2 keyspace scan, an open-ended range is bounded by the next keyspace prefix. The final TiKV region has an empty end key, so comparing it to that nonempty range bound does not terminate the scan. Another request starts at the empty key. Stop after processing the final region response, and test that a scan with remaining limit sends only one request. Signed-off-by: lance6716 <lance6716@gmail.com>
b0e351e to
930e46a
Compare
Signed-off-by: lance6716 <lance6716@gmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ekexium, iosmanthus The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|

Summary
For an API v2 keyspace scan, an open-ended range has an encoded upper bound at the next keyspace prefix. The final TiKV region has an empty end key, so the existing range comparison does not stop the scan. The client can then send another request starting at the empty key.
Stop after processing the final region response. This is in the shared path used by
scanandscan_reverse.Regression test
A mocked final region returns one key with a requested limit of two. The parameterized test asserts that both
scanandscan_reversereturn that key after exactly one request. Applied to the previous upstream code, both cases fail because they issue a second request; both pass with this fix.Verification
cargo fmt --all -- --checkcargo test --lib— 104 passedgit diff --checkThe integration suite requires a running PD/TiKV cluster and was not run locally.
Summary by CodeRabbit