Skip to content

iterator: reset bounds and reseek ordinary iterators - #864

Draft
jwc1love wants to merge 3 commits into
tikv:masterfrom
jwc1love:iterator/reset-bounds-and-seek-signed
Draft

jwc1love wants to merge 3 commits into
tikv:masterfrom
jwc1love:iterator/reset-bounds-and-seek-signed

Conversation

@jwc1love

@jwc1love jwc1love commented Oct 15, 2026 •

Copy link
Copy Markdown

Enable iterator reuse across bounded scan ranges for tikv/tikv#4239. DBIterator::reset_bounds_and_seek replaces owned bounds and performs a hard forward or reverse seek while retaining the snapshot and other read options. None means unsupported without mutation; Some(false) means a supported empty result. Titan, tailing, and missing/empty-bound configurations reject reset before mutation. Callers must honor column-family comparator and prefix constraints; TiKV rejects prefix-seek reuse. No native ABI or submodule change is required.

Validation at 778cab5e4bcbfa3ebdc88fa7b38c8d97c0d0b43f: all 15 iterator cases passed (8 bounds-reset regressions and 7 existing tests), including a new case that asserts at least three L1 SSTs and retained range-tombstone fragments after compaction. It checks explicit key/value expectations and fresh iterators across forward/reverse file jumps, EOF, expanded bounds, empty ranges, reinsertion, and revisited ranges.

Expanded validation uses the canonical tests/tests.rs entry point through normal Cargo. The initial single-process suite aborts with SIGSEGV; all 143 cases were then executed independently: 140 passed and 3 crashed. These three also crash separately on unmodified base 797c014576c9f01a854bd681711c617c5920c9c6 with the same native cache:

  • cases::test_rocksdb_options::test_block_based_options
  • cases::test_statistics::test_db_statistics
  • cases::test_statistics::test_shared_db_statistics

The root cause remains unresolved. Only these three cases were baseline-compared; this is not a successful single-process suite or a full baseline-suite comparison. Native RocksDB/Titan artifacts remained cached. Both repositories passed formatting checks. Downstream TiKV passes all six scanner integration cases, including real Region/Hybrid cache fallback, snapshot visibility, region bounds, locks, and statistics.

Verification report and separate follow-up evidence: https://github.com/jwc1love/tikv/blob/coprocessor/reuse-mvcc-scanner-4239/tests/benches/coprocessor_executors/scanner_reuse_4239.md

Supersedes #863 to correct its author/DCO identity. The original measured wrapper revision ab3a8c… and republished cc93046… have identical trees; 778cab5… adds only the new regression test. Keep draft pending API/native-bound review and full CI; platform, release, and production validation remain outstanding.

Republish the tested implementation with a sign-off matching the GitHub commit author. Source is unchanged from ab3a8c4.

Signed-off-by: jwc1love <155615614+jwc1love@users.noreply.github.com>
Signed-off-by: jwc1love <jwc20050401@gmail.com>
Republish all seven reset regression tests unchanged from tested commit ab3a8c4.

Signed-off-by: jwc1love <155615614+jwc1love@users.noreply.github.com>
Signed-off-by: jwc1love <jwc20050401@gmail.com>
@ti-chi-bot ti-chi-bot Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the dco. labels Oct 15, 2026
@ti-chi-bot

ti-chi-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign imtbkcat for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot ti-chi-bot Bot added contribution This PR is from a community contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Oct 15, 2026
@ti-chi-bot

ti-chi-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

Hi @jwc1love. Thanks for your PR.

I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 15, 2026
… L1 files

Force at least three L1 SSTs, retain range tombstone fragments using an old snapshot, and compare both iterator directions with fresh scans and explicit full key/value expectations. Covers EOF, widening bounds and revisiting earlier files. The new regression passed in the canonical wrapper test target.

Signed-off-by: jwc1love <155615614+jwc1love@users.noreply.github.com>
Signed-off-by: jwc1love <jwc20050401@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant