diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionServerAdmin.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionServerAdmin.java index bbbcdf2055cb..7a591ac9542b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionServerAdmin.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionServerAdmin.java @@ -96,6 +96,11 @@ private interface RpcCall { } private CompletableFuture call(RpcCall rpcCall, CellScanner cellScanner) { + return call(rpcCall, cellScanner, true); + } + + private CompletableFuture call(RpcCall rpcCall, CellScanner cellScanner, + boolean translateException) { CompletableFuture future = new CompletableFuture<>(); HBaseRpcController controller = conn.rpcControllerFactory.newController(cellScanner); try { @@ -104,8 +109,10 @@ private CompletableFuture call(RpcCall rpcCall, CellScanner c @Override public void run(RESP resp) { if (controller.failed()) { - future - .completeExceptionally(ConnectionUtils.translateException(controller.getFailed())); + Throwable error = + translateException ? ConnectionUtils.translateException(controller.getFailed()) + : controller.getFailed(); + future.completeExceptionally(error); } else { future.complete(resp); } @@ -161,8 +168,10 @@ public CompletableFuture compactRegion(CompactRegionReque public CompletableFuture replicateWALEntry( ReplicateWALEntryRequest request, CellScanner cellScanner) { + // The retry logic in upper layer needs to know whether the exception is constructed at remote + // side or local side, so we do not translate the exception here. return call((stub, controller, done) -> stub.replicateWALEntry(controller, request, done), - cellScanner); + cellScanner, false); } public CompletableFuture replay(ReplicateWALEntryRequest request,