Skip to content

Commit 16642f1

Browse files
Handle RejectedExecutionException in ShardFollowTasksExecutor (#65648) (#65653)
Follow-up to #65415. We can't have this exception bubble up in an exception handler any longer due to the new assertion so we must handle it here.
1 parent 6bbeedc commit 16642f1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowTasksExecutor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.elasticsearch.common.settings.Settings;
4343
import org.elasticsearch.common.settings.SettingsModule;
4444
import org.elasticsearch.common.unit.TimeValue;
45+
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
4546
import org.elasticsearch.common.util.concurrent.ThreadContext;
4647
import org.elasticsearch.index.Index;
4748
import org.elasticsearch.index.IndexNotFoundException;
@@ -544,7 +545,12 @@ protected void nodeOperation(final AllocatedPersistentTask task, final ShardFoll
544545
if (ShardFollowNodeTask.shouldRetry(e)) {
545546
logger.debug(new ParameterizedMessage("failed to fetch follow shard global {} checkpoint and max sequence number",
546547
shardFollowNodeTask), e);
547-
threadPool.schedule(() -> nodeOperation(task, params, state), params.getMaxRetryDelay(), Ccr.CCR_THREAD_POOL_NAME);
548+
try {
549+
threadPool.schedule(() -> nodeOperation(task, params, state), params.getMaxRetryDelay(), Ccr.CCR_THREAD_POOL_NAME);
550+
} catch (EsRejectedExecutionException rex) {
551+
rex.addSuppressed(e);
552+
shardFollowNodeTask.onFatalFailure(rex);
553+
}
548554
} else {
549555
shardFollowNodeTask.onFatalFailure(e);
550556
}

0 commit comments

Comments
 (0)