Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reverse scan for scene of multiple regions #438

Merged
merged 2 commits into from
Nov 28, 2023

Conversation

pingyu
Copy link
Collaborator

@pingyu pingyu commented Nov 25, 2023

Close #436

Fix the issue by swap start_key & end_key before requesting regions from PD, and swap back before apply shards to request. As the start_key & end_key in reverse range request are in the meaning of [end_key, start_key).

The issue can be reproduced before the shardable_range was fixed. See 435cf0a:

MULTI_REGION=1 cargo test txn_scan_reverse --all --features "integration-tests" -- --nocapture
    Finished test [unoptimized + debuginfo] target(s) in 0.11s
     Running unittests src/lib.rs (target/debug/deps/tikv_client-ebeddab360b427a7)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 39 filtered out; finished in 0.00s

     Running tests/failpoint_tests.rs (target/debug/deps/failpoint_tests-f2d522e63dab2b69)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 5 filtered out; finished in 0.00s

     Running tests/integration_tests.rs (target/debug/deps/integration_tests-aae509a3e2e0836d)

running 1 test
init finish with 290 regions
Error: MultipleKeyErrors([KeyError(KeyError { locked: None, retryable: "", abort: "Error(Txn(Error(InvalidReqRange { start: Some([0, 0, 0, 0, 0, 0, 0, 0, 251]), end: Some([192, 0, 0, 0, 0, 0, 0, 0, 252]), lower_bound: Some([191, 191, 253, 1, 0, 0, 0, 0, 251]), upper_bound: Some([193, 63, 252, 251, 0, 0, 0, 0, 251]) })))", conflict: None, already_exist: None, deadlock: None, commit_ts_expired: None, txn_not_found: None, commit_ts_too_large: None, assertion_failed: None })])
test txn_scan_reverse ... FAILED

failures:

failures:
    txn_scan_reverse

See also https://github.com/tikv/client-rust/actions/runs/6989951811/job/19018973704?pr=438.

Signed-off-by: Ping Yu <[email protected]>
@pingyu
Copy link
Collaborator Author

pingyu commented Nov 25, 2023

CC @jmhrpr. Thank you for providing the clue! I will fix it this weekend.

Signed-off-by: Ping Yu <[email protected]>
@pingyu pingyu changed the title [WIP] Fix reverse scan for scene of multiple regions Fix reverse scan for scene of multiple regions Nov 26, 2023
@iosmanthus iosmanthus merged commit bbaf317 into tikv:master Nov 28, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InvalidReqRange with scan_reverse
2 participants