mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-27 10:28:28 +00:00
Stop renew retention leases when follow task fails (#65168)
If a shard follow-task hits a non-retryable error and stops, then we should also stop the retention-leases renewal process associated with that follow-task.
This commit is contained in:
parent
2e079b1b9b
commit
3989243a52
@ -531,12 +531,18 @@ public abstract class ShardFollowNodeTask extends AllocatedPersistentTask {
|
||||
scheduler.accept(TimeValue.timeValueMillis(delay), task);
|
||||
}
|
||||
} else {
|
||||
setFatalException(e);
|
||||
onFatalFailure(e);
|
||||
}
|
||||
}
|
||||
|
||||
void setFatalException(Exception e) {
|
||||
fatalException = ExceptionsHelper.convertToElastic(e);
|
||||
final void onFatalFailure(Exception e) {
|
||||
synchronized (this) {
|
||||
this.fatalException = ExceptionsHelper.convertToElastic(e);
|
||||
if (this.renewable != null) {
|
||||
this.renewable.cancel();
|
||||
this.renewable = null;
|
||||
}
|
||||
}
|
||||
LOGGER.warn("shard follow task encounter non-retryable error", e);
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ public class ShardFollowTasksExecutor extends PersistentTasksExecutor<ShardFollo
|
||||
shardFollowNodeTask), e);
|
||||
threadPool.schedule(() -> nodeOperation(task, params, state), params.getMaxRetryDelay(), Ccr.CCR_THREAD_POOL_NAME);
|
||||
} else {
|
||||
shardFollowNodeTask.setFatalException(e);
|
||||
shardFollowNodeTask.onFatalFailure(e);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ public class ShardFollowNodeTaskTests extends ESTestCase {
|
||||
assertThat(status.followerGlobalCheckpoint(), equalTo(-1L));
|
||||
}
|
||||
|
||||
public void testNonRetryableError() {
|
||||
public void testNonRetryableError() throws Exception {
|
||||
ShardFollowTaskParams params = new ShardFollowTaskParams();
|
||||
params.maxReadRequestOperationCount = 64;
|
||||
params.maxOutstandingReadRequests = 1;
|
||||
@ -1031,6 +1031,7 @@ public class ShardFollowNodeTaskTests extends ESTestCase {
|
||||
ShardFollowNodeTaskStatus status = task.getStatus();
|
||||
assertThat(status.outstandingWriteRequests(), equalTo(1));
|
||||
assertThat(status.followerGlobalCheckpoint(), equalTo(-1L));
|
||||
assertBusy(() -> assertNull(task.getRenewable()));
|
||||
}
|
||||
|
||||
public void testMaxWriteRequestSize() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user