-
Notifications
You must be signed in to change notification settings - Fork 118
Fix pd request throws invalid store id #337
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 pd request throws invalid store id #337
Conversation
Signed-off-by: birdstorm <samuelwyf@hotmail.com>
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")) { |
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.
can we directly check whether the instance is of InvalidStoreException?
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.
BTW, should the error message be Invalid storeId?
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.
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(); |
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.
we should log info or warn messages for this critical operation.
Signed-off-by: birdstorm <samuelwyf@hotmail.com>
zz-jason
left a comment
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
marsishandsome
left a comment
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
|
/merge |
|
/run-all-tests |
|
@birdstorm merge failed. |
|
/merge |
|
/run-all-tests |
|
@birdstorm merge failed. |
|
/run-all-tests |
fe9c73f
marsishandsome
left a comment
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
|
/merge |
|
Your auto merge job has been accepted, waiting for:
|
|
/run-all-tests |
Signed-off-by: marsishandsome <marsishandsome@gmail.com>
Signed-off-by: marsishandsome <marsishandsome@gmail.com>
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.