From 3d79810746dd43a3a7bd15b607192ec9a1c5b587 Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 28 Jul 2021 11:40:11 +0100 Subject: [PATCH 1/2] Fix pending deletes timeout log message In 2f0d1586925a we introduced a message reporting a timeout of 30 seconds when acquiring shard locks in order to delete an index, but in fact the timeout is 30 minutes. This commit fixes the message. --- .../indices/cluster/IndicesClusterStateService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java b/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java index 22465754fa4ee..577205efc643c 100644 --- a/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java +++ b/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java @@ -327,14 +327,15 @@ public void onFailure(Exception e) { @Override protected void doRun() throws Exception { + final TimeValue timeout = TimeValue.timeValueMinutes(30); try { // we are waiting until we can lock the index / all shards on the node and then we ack the delete of the store // to the master. If we can't acquire the locks here immediately there might be a shard of this index still // holding on to the lock due to a "currently canceled recovery" or so. The shard will delete itself BEFORE the // lock is released so it's guaranteed to be deleted by the time we get the lock - indicesService.processPendingDeletes(index, indexSettings, new TimeValue(30, TimeUnit.MINUTES)); + indicesService.processPendingDeletes(index, indexSettings, timeout); } catch (ShardLockObtainFailedException exc) { - logger.warn("[{}] failed to lock all shards for index - timed out after 30 seconds", index); + logger.warn("[{}] failed to lock all shards for index - timed out after [{}]]", index, timeout); } catch (InterruptedException e) { logger.warn("[{}] failed to lock all shards for index - interrupted", index); } From 87d83ba34d725e36ca170c53de340b3c17919edf Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 28 Jul 2021 12:08:43 +0100 Subject: [PATCH 2/2] Imports --- .../indices/cluster/IndicesClusterStateService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java b/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java index 577205efc643c..7e3750ec40251 100644 --- a/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java +++ b/server/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java @@ -29,14 +29,14 @@ import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.core.Nullable; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.core.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.common.util.concurrent.ThreadContext; +import org.elasticsearch.core.Nullable; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.env.ShardLockObtainFailedException; import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.index.Index; @@ -76,7 +76,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; import java.util.function.Consumer;