Skip to content

Commit 1465841

Browse files
committed
HBASE-22303 Fix TestReplicationDroppedTables
1 parent 4be510b commit 1465841

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionServerAdmin.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ private interface RpcCall<RESP> {
9696
}
9797

9898
private <RESP> CompletableFuture<RESP> call(RpcCall<RESP> rpcCall, CellScanner cellScanner) {
99+
return call(rpcCall, cellScanner, true);
100+
}
101+
102+
private <RESP> CompletableFuture<RESP> call(RpcCall<RESP> rpcCall, CellScanner cellScanner,
103+
boolean translateException) {
99104
CompletableFuture<RESP> future = new CompletableFuture<>();
100105
HBaseRpcController controller = conn.rpcControllerFactory.newController(cellScanner);
101106
try {
@@ -104,8 +109,10 @@ private <RESP> CompletableFuture<RESP> call(RpcCall<RESP> rpcCall, CellScanner c
104109
@Override
105110
public void run(RESP resp) {
106111
if (controller.failed()) {
107-
future
108-
.completeExceptionally(ConnectionUtils.translateException(controller.getFailed()));
112+
Throwable error =
113+
translateException ? ConnectionUtils.translateException(controller.getFailed())
114+
: controller.getFailed();
115+
future.completeExceptionally(error);
109116
} else {
110117
future.complete(resp);
111118
}
@@ -161,8 +168,10 @@ public CompletableFuture<CompactRegionResponse> compactRegion(CompactRegionReque
161168

162169
public CompletableFuture<ReplicateWALEntryResponse> replicateWALEntry(
163170
ReplicateWALEntryRequest request, CellScanner cellScanner) {
171+
// The retry logic in upper layer needs to know whether the exception is constructed at remote
172+
// side or local side, so we do not translate the exception here.
164173
return call((stub, controller, done) -> stub.replicateWALEntry(controller, request, done),
165-
cellScanner);
174+
cellScanner, false);
166175
}
167176

168177
public CompletableFuture<ReplicateWALEntryResponse> replay(ReplicateWALEntryRequest request,

0 commit comments

Comments
 (0)