Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/main/java/org/tikv/common/PDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,16 @@ private <T> PDErrorHandler<GetStoreResponse> buildPDErrorHandler() {

@Override
public Store getStore(BackOffer backOffer, long storeId) {
return callWithRetry(
backOffer, PDGrpc.getGetStoreMethod(), buildGetStoreReq(storeId), buildPDErrorHandler())
.getStore();
GetStoreResponse resp =
callWithRetry(
backOffer,
PDGrpc.getGetStoreMethod(),
buildGetStoreReq(storeId),
buildPDErrorHandler());
if (resp != null) {
return resp.getStore();
}
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add some comments about:

  1. the possible scenarios where get store fails with a null response
  2. why not throw an exception in those scenarios

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private boolean checkStoreHealth(TiStore store) {
private boolean checkStoreTombstone(TiStore store) {
try {
Metapb.Store newStore = pdClient.getStore(ConcreteBackOffer.newRawKVBackOff(), store.getId());
if (newStore.getState() == Metapb.StoreState.Tombstone) {
if (newStore != null && newStore.getState() == Metapb.StoreState.Tombstone) {
return true;
}
} catch (Exception e) {
Expand Down