Skip to content

Commit

Permalink
Fix case where callable comes with its own RetryingTimeTracker
Browse files Browse the repository at this point in the history
  • Loading branch information
bbeaudreault committed Dec 2, 2022
1 parent 782b9bb commit 7ba30c7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,28 @@ SingleServerRequestRunnable createSingleServerRequest(MultiAction multiAction, i
return new SingleServerRequestRunnable(multiAction, numAttempt, server, callsInProgress);
}

/**
* Some checked calls send a callable with their own tracker. This method checks the operation
* timeout against the appropriate tracker, or returns false if no tracker.
*/
private boolean isOperationTimeoutExceeded() {
RetryingTimeTracker currentTracker;
if (tracker != null) {
currentTracker = tracker;
} else if (currentCallable != null && currentCallable.getTracker() != null) {
currentTracker = currentCallable.getTracker();
} else {
return false;
}

// no-op if already started, this is just to ensure it was initialized (usually true)
currentTracker.start();

// return value of 1 is special to mean exceeded, to differentiate from 0
// which is no timeout. see implementation of getRemainingTime
return currentTracker.getRemainingTime(operationTimeout) == 1;
}

/**
* Group a list of actions per region servers, and send them.
* @param currentActions - the list of row to submit
Expand All @@ -420,9 +442,7 @@ void groupAndSendMultiAction(List<Action> currentActions, int numAttempt) {
boolean isReplica = false;
List<Action> unknownReplicaActions = null;
for (Action action : currentActions) {
if (tracker.getRemainingTime(operationTimeout) == 1) {
// return value of 1 is special to mean exceeded, to differentiate from 0
// which is no timeout. see implementation of getRemainingTime
if (isOperationTimeoutExceeded()) {
String message = numAttempt == 1
? "Operation timeout exceeded during resolution of region locations, "
+ "prior to executing any actions."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,8 @@ protected ClientProtos.ScanResponse doScan(ClientProtos.ScanRequest request)
throws org.apache.hbase.thirdparty.com.google.protobuf.ServiceException {
return getStub().cleanupBulkLoad(getRpcController(), request);
}

RetryingTimeTracker getTracker() {
return tracker;
}
}

0 comments on commit 7ba30c7

Please sign in to comment.