Skip to content

HADOOP-18191. Log retry count while handling exceptions in RetryInvocationHandler #4133

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

Merged
merged 1 commit into from
Apr 8, 2022
Merged
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 @@ -387,12 +387,12 @@ private RetryInfo handleException(final Method method, final int callId,
throw retryInfo.getFailException();
}

log(method, retryInfo.isFailover(), counters.failovers, retryInfo.delay, e);
log(method, retryInfo.isFailover(), counters.failovers, counters.retries, retryInfo.delay, e);
return retryInfo;
}

private void log(final Method method, final boolean isFailover,
final int failovers, final long delay, final Exception ex) {
private void log(final Method method, final boolean isFailover, final int failovers,
final int retries, final long delay, final Exception ex) {
boolean info = true;
// If this is the first failover to this proxy, skip logging at INFO level
if (!failedAtLeastOnce.contains(proxyDescriptor.getProxyInfo().toString()))
Expand All @@ -408,13 +408,15 @@ private void log(final Method method, final boolean isFailover,
}

final StringBuilder b = new StringBuilder()
.append(ex + ", while invoking ")
.append(ex)
.append(", while invoking ")
.append(proxyDescriptor.getProxyInfo().getString(method.getName()));
if (failovers > 0) {
b.append(" after ").append(failovers).append(" failover attempts");
}
b.append(isFailover? ". Trying to failover ": ". Retrying ");
b.append(delay > 0? "after sleeping for " + delay + "ms.": "immediately.");
b.append(" Current retry count: ").append(retries).append(".");

if (info) {
LOG.info(b.toString());
Expand Down