Skip to content

Commit

Permalink
HBASE-22303 Fix TestReplicationDroppedTables
Browse files Browse the repository at this point in the history
  • Loading branch information
Apache9 committed Apr 25, 2019
1 parent 4be510b commit 1465841
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ private interface RpcCall<RESP> {
}

private <RESP> CompletableFuture<RESP> call(RpcCall<RESP> rpcCall, CellScanner cellScanner) {
return call(rpcCall, cellScanner, true);
}

private <RESP> CompletableFuture<RESP> call(RpcCall<RESP> rpcCall, CellScanner cellScanner,
boolean translateException) {
CompletableFuture<RESP> future = new CompletableFuture<>();
HBaseRpcController controller = conn.rpcControllerFactory.newController(cellScanner);
try {
Expand All @@ -104,8 +109,10 @@ private <RESP> CompletableFuture<RESP> call(RpcCall<RESP> 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);
}
Expand Down Expand Up @@ -161,8 +168,10 @@ public CompletableFuture<CompactRegionResponse> compactRegion(CompactRegionReque

public CompletableFuture<ReplicateWALEntryResponse> 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<ReplicateWALEntryResponse> replay(ReplicateWALEntryRequest request,
Expand Down

0 comments on commit 1465841

Please sign in to comment.