cherry pick #172 to release-3.1 (#175)

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

Co-authored-by: birdstorm <samuelwyf@hotmail.com>
This commit is contained in:
ti-srebot 2021-06-04 12:24:23 +08:00 committed by GitHub
parent 490b4a1e01
commit 01b391ff2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -24,7 +24,7 @@ public class RegionException extends TiKVException {
private final Error regionErr; private final Error regionErr;
public RegionException(Error regionErr) { public RegionException(Error regionErr) {
super("Region Exception occurred" + regionErr.getMessage()); super("Region Exception occurred " + regionErr.getMessage());
this.regionErr = regionErr; this.regionErr = regionErr;
} }

View File

@ -123,9 +123,7 @@ public class KVErrorHandler<RespT> implements ErrorHandler<RespT> {
@Override @Override
public boolean handleResponseError(BackOffer backOffer, RespT resp) { public boolean handleResponseError(BackOffer backOffer, RespT resp) {
if (resp == null) { if (resp == null) {
String msg = String msg = String.format("Request Failed with unknown reason for [%s]", recv.getRegion());
String.format(
"Request Failed with unknown reason for region region [%s]", recv.getRegion());
logger.warn(msg); logger.warn(msg);
return handleRequestError(backOffer, new GrpcException(msg)); return handleRequestError(backOffer, new GrpcException(msg));
} }

View File

@ -56,7 +56,7 @@ public class Batch {
} }
public BackOffer getBackOffer() { public BackOffer getBackOffer() {
return backOffer; return ConcreteBackOffer.create(backOffer);
} }
public TiRegion getRegion() { public TiRegion getRegion() {