Fix pd request throws invalid store id#337
Merged
marsishandsome merged 6 commits intotikv:release-3.1from Nov 21, 2021
Merged
Conversation
Signed-off-by: birdstorm <samuelwyf@hotmail.com>
zz-jason
reviewed
Nov 20, 2021
src/main/java/org/tikv/common/exception/InvalidStoreException.java
Outdated
Show resolved
Hide resolved
| @Override | ||
| public boolean handleRequestError(BackOffer backOffer, Exception e) { | ||
| // store id is not found | ||
| if (e instanceof StatusRuntimeException && e.getMessage().contains("invalid store ID")) { |
Member
There was a problem hiding this comment.
can we directly check whether the instance is of InvalidStoreException?
Member
There was a problem hiding this comment.
BTW, should the error message be Invalid storeId?
Collaborator
Author
There was a problem hiding this comment.
no, the exception tikv returns is a grpc exception, it is a StatusRuntimeException that only contains "invalid store id xx" information in its message.
| public TiStore getStoreById(long id, BackOffer backOffer) { | ||
| TiStore store = getStoreByIdWithBackOff(id, backOffer); | ||
| if (store == null) { | ||
| cache.clearAll(); |
Member
There was a problem hiding this comment.
we should log info or warn messages for this critical operation.
Signed-off-by: birdstorm <samuelwyf@hotmail.com>
ti-srebot
previously approved these changes
Nov 21, 2021
Collaborator
|
/merge |
Collaborator
|
/run-all-tests |
Collaborator
|
@birdstorm merge failed. |
Collaborator
|
/merge |
Collaborator
|
/run-all-tests |
Collaborator
|
@birdstorm merge failed. |
Collaborator
|
/run-all-tests |
fe9c73f
Collaborator
|
/merge |
Collaborator
|
Your auto merge job has been accepted, waiting for:
|
Collaborator
|
/run-all-tests |
marsishandsome
pushed a commit
to marsishandsome/client-java
that referenced
this pull request
Dec 1, 2021
Signed-off-by: marsishandsome <marsishandsome@gmail.com>
marsishandsome
pushed a commit
to marsishandsome/client-java
that referenced
this pull request
Dec 1, 2021
Signed-off-by: marsishandsome <marsishandsome@gmail.com>
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.
When the Java Client requests a store id that PD does not recognize, e.g., the PD was scaled-in and does not know about a scaled-out TiKV, the PD will respond with a
StatusRuntimeExceptionrather than an error wrapped by Response itself.Thus we should resolve StatusRuntimeException so that the invalid store info can be dealt with correctly by clearing all-region/store cache info.