Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-28771 Refactor AsyncRequestFutureImpl.isActionComplete to support non replica actions #6143

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ Retry manageError(int originalIndex, Row row, Retry canRetry, Throwable throwabl
if (canRetry != Retry.YES) {
// Batch.Callback<Res> was not called on failure in 0.94. We keep this.
setError(originalIndex, row, throwable, server);
} else if (isActionComplete(originalIndex, row)) {
} else if (AsyncProcess.isReplicaGet(row) && isActionComplete(originalIndex)) {
canRetry = Retry.NO_OTHER_SUCCEEDED;
}
return canRetry;
Expand Down Expand Up @@ -1164,10 +1164,16 @@ private void setError(int index, Row row, Throwable throwable, ServerName server
* synchronize, assuming element index/field accesses are atomic. This is an opportunistic
* optimization check, doesn't have to be strict.
* @param index Original action index.
* @param row Original request.
* @return If results are non-null, returns whether a result is currently set for action index.
* @throws IllegalStateException If results are null. We cannot readily tell here whether an
* action that is part of an AsyncRequestFuture that doesn't track
* results is complete
*/
private boolean isActionComplete(int index, Row row) {
if (!AsyncProcess.isReplicaGet(row)) return false;
private boolean isActionComplete(int index) {
if (results == null) {
throw new IllegalStateException(
String.format("Cannot check action %d completion when results are null", index));
}
Object resObj = results[index];
return (resObj != null)
&& (!(resObj instanceof ReplicaResultState) || ((ReplicaResultState) resObj).callCount == 0);
Expand Down