[
https://issues.apache.org/jira/browse/FLINK-33698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
xiangyu feng updated FLINK-33698:
---------------------------------
Description:
The backoff time calculation in `ExponentialBackoffDelayRetryStrategy` is
problematic due to the lack of a reset when reusing the object.
Current Version:
{code:java}
@Override
public long getBackoffTimeMillis(int currentAttempts) {
if (currentAttempts <= 1) {
// equivalent to initial delay
return lastRetryDelay;
}
long backoff = Math.min((long) (lastRetryDelay * multiplier),
maxRetryDelay);
this.lastRetryDelay = backoff;
return backoff;
} {code}
Fixed Version:
{code:java}
@Override
public long getBackoffTimeMillis(int currentAttempts) {
if (currentAttempts <= 1) {
// reset to initialDelay
this.lastRetryDelay = initialDelay;
return lastRetryDelay;
}
long backoff = Math.min((long) (lastRetryDelay * multiplier),
maxRetryDelay);
this.lastRetryDelay = backoff;
return backoff;
}{code}
was:
The backoff time calculation in `ExponentialBackoffDelayRetryStrategy` should
consider currentAttempts.
Current Version:
{code:java}
@Override
public long getBackoffTimeMillis(int currentAttempts) {
if (currentAttempts <= 1) {
// equivalent to initial delay
return lastRetryDelay;
}
long backoff = Math.min((long) (lastRetryDelay * multiplier),
maxRetryDelay);
this.lastRetryDelay = backoff;
return backoff;
} {code}
Fixed Version:
{code:java}
@Override
public long getBackoffTimeMillis(int currentAttempts) {
if (currentAttempts <= 1) {
// reset to initialDelay
this.lastRetryDelay = initialDelay;
return lastRetryDelay;
}
long backoff = Math.min((long) (lastRetryDelay * multiplier),
maxRetryDelay);
this.lastRetryDelay = backoff;
return backoff;
}{code}
> Fix the backoff time calculation in ExponentialBackoffDelayRetryStrategy
> ------------------------------------------------------------------------
>
> Key: FLINK-33698
> URL: https://issues.apache.org/jira/browse/FLINK-33698
> Project: Flink
> Issue Type: Bug
> Components: API / DataStream
> Reporter: xiangyu feng
> Assignee: xiangyu feng
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.19.0
>
>
> The backoff time calculation in `ExponentialBackoffDelayRetryStrategy` is
> problematic due to the lack of a reset when reusing the object.
>
> Current Version:
> {code:java}
> @Override
> public long getBackoffTimeMillis(int currentAttempts) {
> if (currentAttempts <= 1) {
> // equivalent to initial delay
> return lastRetryDelay;
> }
> long backoff = Math.min((long) (lastRetryDelay * multiplier),
> maxRetryDelay);
> this.lastRetryDelay = backoff;
> return backoff;
> } {code}
> Fixed Version:
> {code:java}
> @Override
> public long getBackoffTimeMillis(int currentAttempts) {
> if (currentAttempts <= 1) {
> // reset to initialDelay
> this.lastRetryDelay = initialDelay;
> return lastRetryDelay;
> }
> long backoff = Math.min((long) (lastRetryDelay * multiplier),
> maxRetryDelay);
> this.lastRetryDelay = backoff;
> return backoff;
> }{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)