-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
*: check region epoch strictly #4125
Conversation
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Please fix conflicts |
Please refer to the related kvproto PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most LGTM. Seems that we should reproduce the issue in test
Signed-off-by: Neil Shen <overvenus@gmail.com>
@Connor1996 It is reproduced in test_split_epoch_not_match. |
/release |
PTAL, thanks! |
any update about this and corresponding other PRs? |
Signed-off-by: Neil Shen <overvenus@gmail.com>
/run-integration-tests tidb=release-2.1 pd=release-2.1 tidb-test=release-2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/release |
There seems to be no case about the situation you describe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There is a test case covers the situation https://github.com/tikv/tikv/pull/4125/files#diff-87d8831b47ad20a68a88901c547ce300R628. It sends a requests with a newer epoch and get a key which is out of the region. @BusyJay |
Checks region epoch strictly to avoid KeyNotInRegion errors. A 3 nodes TiKV cluster with merge enabled, after commit merge, TiKV A tells TiDB with a epoch not match error contains the latest target Region info, TiDB updates its region cache and sends requests to TiKV B, and TiKV B has not applied commit merge yet, since the region epoch in request is higher than TiKV B, the request must be denied due to epoch not match, so it does not read on a stale snapshot, thus avoid the KeyNotInRegion error. Signed-off-by: Neil Shen <overvenus@gmail.com>
Checks region epoch strictly to avoid KeyNotInRegion errors. A 3 nodes TiKV cluster with merge enabled, after commit merge, TiKV A tells TiDB with a epoch not match error contains the latest target Region info, TiDB updates its region cache and sends requests to TiKV B, and TiKV B has not applied commit merge yet, since the region epoch in request is higher than TiKV B, the request must be denied due to epoch not match, so it does not read on a stale snapshot, thus avoid the KeyNotInRegion error. Signed-off-by: Neil Shen <overvenus@gmail.com>
What have you changed?
Checks region epoch strictly to avoid KeyNotInRegion errors.
A 3 nodes TiKV cluster with merge enabled, after commit merge, TiKV A
tells TiDB with a epoch not match error contains the latest target Region
info, TiDB updates its region cache and sends requests to TiKV B,
and TiKV B has not applied commit merge yet, since the region epoch in
request is higher than TiKV B, the request must be denied due to epoch
not match, so it does not read on a stale snapshot, thus avoid the
KeyNotInRegion error.
What are the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
Integrations tests
Does this PR affect documentation (docs) update? (mandatory)
No
Does this PR affect tidb-ansible update? (mandatory)
No
Cc pingcap/kvproto#344