HBASE-22282 Should deal with error in the callback of RawAsyncHBaseAdmin.splitRegion methods

This commit is contained in:
zhangduo 2019-04-21 23:03:05 +08:00 committed by Duo Zhang
parent c015c6cac0
commit 38c7ab59a2
1 changed files with 8 additions and 0 deletions

View File

@ -1371,6 +1371,10 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
public CompletableFuture<Void> splitRegion(byte[] regionName) { public CompletableFuture<Void> splitRegion(byte[] regionName) {
CompletableFuture<Void> future = new CompletableFuture<>(); CompletableFuture<Void> future = new CompletableFuture<>();
addListener(getRegionLocation(regionName), (location, err) -> { addListener(getRegionLocation(regionName), (location, err) -> {
if (err != null) {
future.completeExceptionally(err);
return;
}
RegionInfo regionInfo = location.getRegion(); RegionInfo regionInfo = location.getRegion();
if (regionInfo.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) { if (regionInfo.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) {
future future
@ -1401,6 +1405,10 @@ class RawAsyncHBaseAdmin implements AsyncAdmin {
"splitPoint is null. If you don't specify a splitPoint, use splitRegion(byte[]) instead"); "splitPoint is null. If you don't specify a splitPoint, use splitRegion(byte[]) instead");
CompletableFuture<Void> future = new CompletableFuture<>(); CompletableFuture<Void> future = new CompletableFuture<>();
addListener(getRegionLocation(regionName), (location, err) -> { addListener(getRegionLocation(regionName), (location, err) -> {
if (err != null) {
future.completeExceptionally(err);
return;
}
RegionInfo regionInfo = location.getRegion(); RegionInfo regionInfo = location.getRegion();
if (regionInfo.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) { if (regionInfo.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) {
future future