diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/AsyncActionStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/AsyncActionStep.java index c20323da83031..cee134689e3c4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/AsyncActionStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/AsyncActionStep.java @@ -11,9 +11,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.metadata.IndexMetadata; -import org.elasticsearch.core.TimeValue; - -import java.util.Objects; /** * Performs an action which must be performed asynchronously because it may take time to complete. @@ -31,11 +28,6 @@ protected Client getClient() { return client; } - public static TimeValue getMasterTimeout(ClusterState clusterState){ - Objects.requireNonNull(clusterState, "cannot determine master timeout when cluster state is null"); - return LifecycleSettings.LIFECYCLE_STEP_MASTER_TIMEOUT_SETTING.get(clusterState.metadata().settings()); - } - public boolean indexSurvives() { return true; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupShrinkIndexStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupShrinkIndexStep.java index c009830b27020..94bc1d411fc93 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupShrinkIndexStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupShrinkIndexStep.java @@ -15,6 +15,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.index.IndexNotFoundException; import static org.elasticsearch.xpack.core.ilm.LifecycleExecutionState.fromIndexMetadata; @@ -59,7 +60,7 @@ void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentCl return; } getClient().admin().indices() - .delete(new DeleteIndexRequest(shrinkIndexName).masterNodeTimeout(getMasterTimeout(currentClusterState)), + .delete(new DeleteIndexRequest(shrinkIndexName).masterNodeTimeout(TimeValue.MAX_VALUE), new ActionListener() { @Override public void onResponse(AcknowledgedResponse acknowledgedResponse) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStep.java index 7edfb56dd1b27..89bd05eeb5e56 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStep.java @@ -8,12 +8,12 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.repositories.RepositoryMissingException; import org.elasticsearch.snapshots.SnapshotMissingException; @@ -50,8 +50,8 @@ void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentCl listener.onResponse(true); return; } - DeleteSnapshotRequest deleteSnapshotRequest = new DeleteSnapshotRequest(repositoryName, snapshotName); - getClient().admin().cluster().deleteSnapshot(deleteSnapshotRequest, new ActionListener<>() { + getClient().admin().cluster().prepareDeleteSnapshot(repositoryName, snapshotName).setMasterNodeTimeout(TimeValue.MAX_VALUE) + .execute(new ActionListener<>() { @Override public void onResponse(AcknowledgedResponse acknowledgedResponse) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CloseFollowerIndexStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CloseFollowerIndexStep.java index 72112cd38b323..d8b9d31e81f58 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CloseFollowerIndexStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CloseFollowerIndexStep.java @@ -12,6 +12,7 @@ import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.core.TimeValue; import java.util.Map; @@ -41,7 +42,7 @@ void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentCl if (indexMetadata.getState() == IndexMetadata.State.OPEN) { CloseIndexRequest closeIndexRequest = new CloseIndexRequest(followerIndex) - .masterNodeTimeout(getMasterTimeout(currentClusterState)); + .masterNodeTimeout(TimeValue.MAX_VALUE); getClient().admin().indices().close(closeIndexRequest, ActionListener.wrap( r -> { if (r.isAcknowledged() == false) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CloseIndexStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CloseIndexStep.java index 5a9716ffc4c3c..37e87d9dac870 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CloseIndexStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CloseIndexStep.java @@ -14,6 +14,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.core.TimeValue; /** * Invokes a close step on a single index. @@ -30,7 +31,7 @@ public class CloseIndexStep extends AsyncActionStep { public void performAction(IndexMetadata indexMetadata, ClusterState currentClusterState, ClusterStateObserver observer, ActionListener listener) { if (indexMetadata.getState() == IndexMetadata.State.OPEN) { - CloseIndexRequest request = new CloseIndexRequest(indexMetadata.getIndex().getName()); + CloseIndexRequest request = new CloseIndexRequest(indexMetadata.getIndex().getName()).masterNodeTimeout(TimeValue.MAX_VALUE); getClient().admin().indices() .close(request, ActionListener.wrap(closeIndexResponse -> { if (closeIndexResponse.isAcknowledged() == false) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStep.java index 226a64d4181ac..66aa6c565602a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStep.java @@ -15,6 +15,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.snapshots.SnapshotInfo; import java.util.Locale; @@ -65,7 +66,7 @@ void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentCl // complete request.waitForCompletion(true); request.includeGlobalState(false); - request.masterNodeTimeout(getMasterTimeout(currentClusterState)); + request.masterNodeTimeout(TimeValue.MAX_VALUE); getClient().admin().cluster().createSnapshot(request, ActionListener.wrap(response -> { logger.debug("create snapshot response for policy [{}] and index [{}] is: {}", policyName, indexName, diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/DeleteStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/DeleteStep.java index 92cbe09e655d1..b6b3389a0f480 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/DeleteStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/DeleteStep.java @@ -14,6 +14,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexAbstraction; import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.xpack.core.action.DeleteDataStreamAction; import java.util.Locale; @@ -57,7 +58,7 @@ public void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState cu } getClient().admin().indices() - .delete(new DeleteIndexRequest(indexName).masterNodeTimeout(getMasterTimeout(currentState)), + .delete(new DeleteIndexRequest(indexName).masterNodeTimeout(TimeValue.MAX_VALUE), ActionListener.wrap(response -> listener.onResponse(true), listener::onFailure)); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/FreezeStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/FreezeStep.java index 0eaec65716976..456e94408b5e1 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/FreezeStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/FreezeStep.java @@ -11,6 +11,7 @@ import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.protocol.xpack.frozen.FreezeRequest; import org.elasticsearch.xpack.core.frozen.action.FreezeIndexAction; @@ -27,7 +28,7 @@ public FreezeStep(StepKey key, StepKey nextStepKey, Client client) { @Override public void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentState, ActionListener listener) { getClient().admin().indices().execute(FreezeIndexAction.INSTANCE, - new FreezeRequest(indexMetadata.getIndex().getName()).masterNodeTimeout(getMasterTimeout(currentState)), + new FreezeRequest(indexMetadata.getIndex().getName()).masterNodeTimeout(TimeValue.MAX_VALUE), ActionListener.wrap(response -> { if (response.isAcknowledged() == false) { throw new ElasticsearchException("freeze index request failed to be acknowledged"); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java index 084d0bf7ada60..1678bc833e943 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java @@ -49,7 +49,7 @@ public class LifecycleSettings { true, Setting.Property.NodeScope); public static final Setting LIFECYCLE_STEP_MASTER_TIMEOUT_SETTING = Setting.positiveTimeSetting(LIFECYCLE_STEP_MASTER_TIMEOUT, TimeValue.timeValueSeconds(30), Setting.Property.Dynamic, - Setting.Property.NodeScope); + Setting.Property.NodeScope, Setting.Property.Deprecated); // This setting configures how much time since step_time should ILM wait for a condition to be met. After the threshold wait time has // elapsed ILM will likely stop waiting and go to the next step. // Also see {@link org.elasticsearch.xpack.core.ilm.ClusterStateWaitUntilThresholdStep} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStep.java index 5ae746a77f082..7d1cd4fd5f369 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStep.java @@ -15,6 +15,7 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider; @@ -121,6 +122,7 @@ void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState currentCl // perform expensive operations (ie. clusterStateProcessed) false, storageType); + mountSearchableSnapshotRequest.masterNodeTimeout(TimeValue.MAX_VALUE); getClient().execute(MountSearchableSnapshotAction.INSTANCE, mountSearchableSnapshotRequest, ActionListener.wrap(response -> { if (response.status() != RestStatus.OK && response.status() != RestStatus.ACCEPTED) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/OpenIndexStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/OpenIndexStep.java index 03f19b07f00cb..dbde37c1d266a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/OpenIndexStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/OpenIndexStep.java @@ -14,6 +14,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.core.TimeValue; /** * Invokes a open step on a single index. @@ -31,7 +32,7 @@ final class OpenIndexStep extends AsyncActionStep { public void performAction(IndexMetadata indexMetadata, ClusterState currentClusterState, ClusterStateObserver observer, ActionListener listener) { if (indexMetadata.getState() == IndexMetadata.State.CLOSE) { - OpenIndexRequest request = new OpenIndexRequest(indexMetadata.getIndex().getName()); + OpenIndexRequest request = new OpenIndexRequest(indexMetadata.getIndex().getName()).masterNodeTimeout(TimeValue.MAX_VALUE); getClient().admin().indices() .open(request, ActionListener.wrap(openIndexResponse -> { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/PauseFollowerIndexStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/PauseFollowerIndexStep.java index 7fb99eb94727a..07cd58f0a137e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/PauseFollowerIndexStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/PauseFollowerIndexStep.java @@ -10,6 +10,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.persistent.PersistentTasksCustomMetadata; import org.elasticsearch.xpack.core.ccr.action.PauseFollowAction; import org.elasticsearch.xpack.core.ccr.action.ShardFollowTask; @@ -52,6 +53,7 @@ void innerPerformAction(String followerIndex, ClusterState currentClusterState, } PauseFollowAction.Request request = new PauseFollowAction.Request(followerIndex); + request.masterNodeTimeout(TimeValue.MAX_VALUE); getClient().execute(PauseFollowAction.INSTANCE, request, ActionListener.wrap( r -> { if (r.isAcknowledged() == false) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ReadOnlyStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ReadOnlyStep.java index 153f262cd2606..76e711c00db9a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ReadOnlyStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ReadOnlyStep.java @@ -14,6 +14,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.metadata.IndexMetadata; +import org.elasticsearch.core.TimeValue; import static org.elasticsearch.cluster.metadata.IndexMetadata.APIBlock.WRITE; @@ -31,7 +32,7 @@ public ReadOnlyStep(StepKey key, StepKey nextStepKey, Client client) { public void performAction(IndexMetadata indexMetadata, ClusterState currentState, ClusterStateObserver observer, ActionListener listener) { getClient().admin().indices().execute(AddIndexBlockAction.INSTANCE, - new AddIndexBlockRequest(WRITE, indexMetadata.getIndex().getName()).masterNodeTimeout(getMasterTimeout(currentState)), + new AddIndexBlockRequest(WRITE, indexMetadata.getIndex().getName()).masterNodeTimeout(TimeValue.MAX_VALUE), ActionListener.wrap(response -> { if (response.isAcknowledged() == false) { throw new ElasticsearchException("read only add block index request failed to be acknowledged"); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverStep.java index 6d17aab80b6be..55d4cbb075316 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RolloverStep.java @@ -17,6 +17,7 @@ import org.elasticsearch.cluster.metadata.IndexAbstraction; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; +import org.elasticsearch.core.TimeValue; import java.util.Locale; import java.util.Objects; @@ -89,8 +90,7 @@ public void performAction(IndexMetadata indexMetadata, ClusterState currentClust } // Calling rollover with no conditions will always roll over the index - RolloverRequest rolloverRequest = new RolloverRequest(rolloverTarget, null) - .masterNodeTimeout(getMasterTimeout(currentClusterState)); + RolloverRequest rolloverRequest = new RolloverRequest(rolloverTarget, null).masterNodeTimeout(TimeValue.MAX_VALUE); // We don't wait for active shards when we perform the rollover because the // {@link org.elasticsearch.xpack.core.ilm.WaitForActiveShardsStep} step will do so rolloverRequest.setWaitForActiveShards(ActiveShardCount.NONE); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RollupStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RollupStep.java index 03418dd610bc7..1bafb0214601c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RollupStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/RollupStep.java @@ -12,6 +12,7 @@ import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.xpack.core.rollup.RollupActionConfig; import org.elasticsearch.xpack.core.rollup.action.RollupAction; @@ -50,7 +51,7 @@ public void performAction(IndexMetadata indexMetadata, ClusterState currentState "] and index [" + indexName + "]")); return; } - RollupAction.Request request = new RollupAction.Request(indexName, rollupIndexName, config); + RollupAction.Request request = new RollupAction.Request(indexName, rollupIndexName, config).masterNodeTimeout(TimeValue.MAX_VALUE); // currently RollupAction always acknowledges action was complete when no exceptions are thrown. getClient().execute(RollupAction.INSTANCE, request, ActionListener.wrap(response -> listener.onResponse(true), listener::onFailure)); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/SetSingleNodeAllocateStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/SetSingleNodeAllocateStep.java index 5d3d280608251..23df008d2bcd0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/SetSingleNodeAllocateStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/SetSingleNodeAllocateStep.java @@ -27,6 +27,7 @@ import org.elasticsearch.common.Randomness; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.xpack.cluster.routing.allocation.DataTierAllocationDecider; @@ -96,7 +97,7 @@ public void performAction(IndexMetadata indexMetadata, ClusterState clusterState Settings settings = Settings.builder() .put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_SETTING.getKey() + "_id", nodeId.get()).build(); UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(indexName) - .masterNodeTimeout(getMasterTimeout(clusterState)) + .masterNodeTimeout(TimeValue.MAX_VALUE) .settings(settings); getClient().admin().indices().updateSettings(updateSettingsRequest, ActionListener.wrap(response -> listener.onResponse(true), listener::onFailure)); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStep.java index 7ecf3bed14e70..073a75f78db31 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStep.java @@ -38,7 +38,7 @@ public void performDuringNoSnapshot(IndexMetadata indexMetadata, ClusterState cu // get target shrink index LifecycleExecutionState lifecycleState = fromIndexMetadata(indexMetadata); String targetIndexName = getShrinkIndexName(indexName, lifecycleState); - deleteSourceIndexAndTransferAliases(getClient(), indexMetadata, getMasterTimeout(currentState), targetIndexName, listener); + deleteSourceIndexAndTransferAliases(getClient(), indexMetadata, targetIndexName, listener); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkStep.java index 3fcc27d6d6712..654605007929f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ShrinkStep.java @@ -16,6 +16,7 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; +import org.elasticsearch.core.TimeValue; import java.util.Objects; @@ -83,7 +84,7 @@ public void performAction(IndexMetadata indexMetadata, ClusterState currentState Settings relevantTargetSettings = builder.build(); ResizeRequest resizeRequest = new ResizeRequest(shrunkenIndexName, indexMetadata.getIndex().getName()) - .masterNodeTimeout(getMasterTimeout(currentState)); + .masterNodeTimeout(TimeValue.MAX_VALUE); resizeRequest.setMaxPrimaryShardSize(maxPrimaryShardSize); resizeRequest.getTargetIndexRequest().settings(relevantTargetSettings); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/SwapAliasesAndDeleteSourceIndexStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/SwapAliasesAndDeleteSourceIndexStep.java index d9ff099e55080..879f6dc1b55ff 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/SwapAliasesAndDeleteSourceIndexStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/SwapAliasesAndDeleteSourceIndexStep.java @@ -60,7 +60,7 @@ public void performAction(IndexMetadata indexMetadata, ClusterState currentClust return; } - deleteSourceIndexAndTransferAliases(getClient(), indexMetadata, getMasterTimeout(currentClusterState), targetIndexName, listener); + deleteSourceIndexAndTransferAliases(getClient(), indexMetadata, targetIndexName, listener); } /** @@ -69,11 +69,11 @@ public void performAction(IndexMetadata indexMetadata, ClusterState currentClust *

* The is_write_index will *not* be set on the target index as this operation is currently executed on read-only indices. */ - static void deleteSourceIndexAndTransferAliases(Client client, IndexMetadata sourceIndex, TimeValue masterTimeoutValue, - String targetIndex, ActionListener listener) { + static void deleteSourceIndexAndTransferAliases(Client client, IndexMetadata sourceIndex, String targetIndex, + ActionListener listener) { String sourceIndexName = sourceIndex.getIndex().getName(); IndicesAliasesRequest aliasesRequest = new IndicesAliasesRequest() - .masterNodeTimeout(masterTimeoutValue) + .masterNodeTimeout(TimeValue.MAX_VALUE) .addAliasAction(IndicesAliasesRequest.AliasActions.removeIndex().index(sourceIndexName)) .addAliasAction(IndicesAliasesRequest.AliasActions.add().index(targetIndex).alias(sourceIndexName)); // copy over other aliases from source index diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UnfollowFollowerIndexStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UnfollowFollowerIndexStep.java index ebad92ac74d25..a6d834ab72edb 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UnfollowFollowerIndexStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UnfollowFollowerIndexStep.java @@ -12,6 +12,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.xpack.core.ccr.action.UnfollowAction; import java.util.List; @@ -32,7 +33,7 @@ public boolean isRetryable() { @Override void innerPerformAction(String followerIndex, ClusterState currentClusterState, ActionListener listener) { - UnfollowAction.Request request = new UnfollowAction.Request(followerIndex); + UnfollowAction.Request request = new UnfollowAction.Request(followerIndex).masterNodeTimeout(TimeValue.MAX_VALUE); getClient().execute(UnfollowAction.INSTANCE, request, ActionListener.wrap( r -> { if (r.isAcknowledged() == false) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UpdateRollupIndexPolicyStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UpdateRollupIndexPolicyStep.java index e81310d8a76cb..96202f03bbb0d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UpdateRollupIndexPolicyStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UpdateRollupIndexPolicyStep.java @@ -15,6 +15,7 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.core.TimeValue; import java.util.Objects; @@ -56,7 +57,7 @@ public void performAction(IndexMetadata indexMetadata, ClusterState currentState } Settings settings = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, rollupPolicy).build(); UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(rollupIndexName) - .masterNodeTimeout(getMasterTimeout(currentState)) + .masterNodeTimeout(TimeValue.MAX_VALUE) .settings(settings); getClient().admin().indices().updateSettings(updateSettingsRequest, ActionListener.wrap(response -> { if (response.isAcknowledged()) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UpdateSettingsStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UpdateSettingsStep.java index 1c77619c7e620..ce0ea1fcf7338 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UpdateSettingsStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/UpdateSettingsStep.java @@ -13,6 +13,7 @@ import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.core.TimeValue; import java.util.Objects; @@ -38,7 +39,7 @@ public boolean isRetryable() { public void performAction(IndexMetadata indexMetadata, ClusterState currentState, ClusterStateObserver observer, ActionListener listener) { UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(indexMetadata.getIndex().getName()) - .masterNodeTimeout(getMasterTimeout(currentState)) + .masterNodeTimeout(TimeValue.MAX_VALUE) .settings(settings); getClient().admin().indices().updateSettings(updateSettingsRequest, ActionListener.wrap(response -> listener.onResponse(true), listener::onFailure)); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AbstractStepMasterTimeoutTestCase.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AbstractStepMasterTimeoutTestCase.java deleted file mode 100644 index 2e81083424a82..0000000000000 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AbstractStepMasterTimeoutTestCase.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -package org.elasticsearch.xpack.core.ilm; - -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.support.master.MasterNodeRequest; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.IndexMetadata; -import org.elasticsearch.cluster.metadata.Metadata; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.core.TimeValue; -import org.elasticsearch.test.client.NoOpClient; -import org.elasticsearch.threadpool.TestThreadPool; -import org.elasticsearch.threadpool.ThreadPool; -import org.junit.After; -import org.junit.Before; - -import java.util.concurrent.atomic.AtomicBoolean; - -import static org.elasticsearch.xpack.core.ilm.LifecycleSettings.LIFECYCLE_STEP_MASTER_TIMEOUT; -import static org.hamcrest.Matchers.equalTo; - -public abstract class AbstractStepMasterTimeoutTestCase extends AbstractStepTestCase { - - protected ThreadPool pool; - - @Before - public void setupThreadPool() { - pool = new TestThreadPool("timeoutTestPool"); - } - - @After - public void shutdownThreadPool() { - pool.shutdownNow(); - } - - public void testMasterTimeout() { - IndexMetadata indexMetadata = getIndexMetadata(); - checkMasterTimeout(TimeValue.timeValueSeconds(30), - ClusterState.builder(ClusterName.DEFAULT).metadata(Metadata.builder().put(indexMetadata, true).build()).build(), indexMetadata); - checkMasterTimeout(TimeValue.timeValueSeconds(10), - ClusterState.builder(ClusterName.DEFAULT) - .metadata(Metadata.builder() - .persistentSettings(Settings.builder().put(LIFECYCLE_STEP_MASTER_TIMEOUT, "10s").build()) - .put(indexMetadata, true) - .build()) - .build(), indexMetadata); - } - - private void checkMasterTimeout(TimeValue timeValue, ClusterState currentClusterState, IndexMetadata indexMetadata) { - AtomicBoolean timeoutChecked = new AtomicBoolean(); - client = new NoOpClient(pool) { - @Override - protected void doExecute(ActionType action, - Request request, - ActionListener listener) { - if (request instanceof MasterNodeRequest) { - assertThat(((MasterNodeRequest) request).masterNodeTimeout(), equalTo(timeValue)); - timeoutChecked.set(true); - } - } - }; - createRandomInstance().performAction(indexMetadata, currentClusterState, null, new ActionListener<>() { - @Override - public void onResponse(Boolean complete) { - - } - - @Override - public void onFailure(Exception e) { - - } - }); - assertTrue(timeoutChecked.get()); - } - - protected abstract IndexMetadata getIndexMetadata(); - - public static ClusterState emptyClusterState() { - return ClusterState.builder(ClusterName.DEFAULT).build(); - } -} diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AbstractStepTestCase.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AbstractStepTestCase.java index 77b465ef2401a..c35f2d070f90b 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AbstractStepTestCase.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AbstractStepTestCase.java @@ -9,6 +9,8 @@ import org.elasticsearch.client.AdminClient; import org.elasticsearch.client.Client; import org.elasticsearch.client.IndicesAdminClient; +import org.elasticsearch.cluster.ClusterName; +import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.core.TimeValue; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.EqualsHashCodeTestUtils; @@ -22,6 +24,10 @@ public abstract class AbstractStepTestCase extends ESTestCase { protected AdminClient adminClient; protected IndicesAdminClient indicesClient; + public static ClusterState emptyClusterState() { + return ClusterState.builder(ClusterName.DEFAULT).build(); + } + @Before public void setupClient() { client = Mockito.mock(Client.class); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AsyncActionBranchingStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AsyncActionBranchingStepTests.java index 6da432acba0e2..829a7f2187da6 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AsyncActionBranchingStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/AsyncActionBranchingStepTests.java @@ -17,7 +17,7 @@ import static org.hamcrest.Matchers.is; -public class AsyncActionBranchingStepTests extends AbstractStepMasterTimeoutTestCase { +public class AsyncActionBranchingStepTests extends AbstractStepTestCase { @Override protected AsyncActionBranchingStep createRandomInstance() { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CheckNoDataStreamWriteIndexStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CheckNoDataStreamWriteIndexStepTests.java index 59d662c01a3ae..39e66e89eee44 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CheckNoDataStreamWriteIndexStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CheckNoDataStreamWriteIndexStepTests.java @@ -16,7 +16,6 @@ import java.util.List; import static org.elasticsearch.cluster.metadata.DataStreamTestHelper.createTimestampField; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CleanupShrinkIndexStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CleanupShrinkIndexStepTests.java index 84bc50da6e81b..56d2506f0bf04 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CleanupShrinkIndexStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CleanupShrinkIndexStepTests.java @@ -21,7 +21,6 @@ import java.util.Map; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.elasticsearch.xpack.core.ilm.GenerateUniqueIndexNameStep.generateValidIndexName; import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.is; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStepTests.java index 4b4d0035c97a8..9ea50597d1e12 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CleanupSnapshotStepTests.java @@ -22,7 +22,6 @@ import java.util.Map; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.is; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CloseFollowerIndexStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CloseFollowerIndexStepTests.java index 85f8c9476bc91..ee13f727dc77c 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CloseFollowerIndexStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CloseFollowerIndexStepTests.java @@ -20,10 +20,9 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -public class CloseFollowerIndexStepTests extends AbstractStepMasterTimeoutTestCase { +public class CloseFollowerIndexStepTests extends AbstractStepTestCase { - @Override - protected IndexMetadata getIndexMetadata() { + private static IndexMetadata getIndexMetadata() { return IndexMetadata.builder("follower-index") .settings(settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE, "true")) .putCustom(CCR_METADATA_KEY, Collections.emptyMap()) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CopySettingsStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CopySettingsStepTests.java index 69024ad0c41a9..78a8e69332436 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CopySettingsStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CopySettingsStepTests.java @@ -11,7 +11,6 @@ import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.Metadata; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.hamcrest.Matchers.is; public class CopySettingsStepTests extends AbstractStepTestCase { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStepTests.java index d829d58c51460..3b390c81cb91b 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/CreateSnapshotStepTests.java @@ -23,7 +23,6 @@ import java.util.HashMap; import java.util.Map; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.hamcrest.Matchers.is; public class CreateSnapshotStepTests extends AbstractStepTestCase { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/DeleteStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/DeleteStepTests.java index fead0741c8666..bb1c18415b62d 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/DeleteStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/DeleteStepTests.java @@ -24,7 +24,7 @@ import static org.elasticsearch.cluster.metadata.DataStreamTestHelper.createTimestampField; import static org.hamcrest.Matchers.is; -public class DeleteStepTests extends AbstractStepMasterTimeoutTestCase { +public class DeleteStepTests extends AbstractStepTestCase { @Override public DeleteStep createRandomInstance() { @@ -58,8 +58,7 @@ public DeleteStep copyInstance(DeleteStep instance) { return new DeleteStep(instance.getKey(), instance.getNextStepKey(), instance.getClient()); } - @Override - protected IndexMetadata getIndexMetadata() { + private static IndexMetadata getIndexMetadata() { return IndexMetadata.builder(randomAlphaOfLength(10)).settings(settings(Version.CURRENT)) .numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5)).build(); } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/FreezeStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/FreezeStepTests.java index d0825a1357f36..0da1a5a329920 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/FreezeStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/FreezeStepTests.java @@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.is; -public class FreezeStepTests extends AbstractStepMasterTimeoutTestCase { +public class FreezeStepTests extends AbstractStepTestCase { @Override public FreezeStep createRandomInstance() { @@ -54,8 +54,7 @@ public FreezeStep copyInstance(FreezeStep instance) { return new FreezeStep(instance.getKey(), instance.getNextStepKey(), instance.getClient()); } - @Override - protected IndexMetadata getIndexMetadata() { + private static IndexMetadata getIndexMetadata() { return IndexMetadata.builder(randomAlphaOfLength(10)).settings(settings(Version.CURRENT)) .numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5)).build(); } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/GenerateSnapshotNameStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/GenerateSnapshotNameStepTests.java index e9b9c5299a3f7..2d1c2a4fe1dce 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/GenerateSnapshotNameStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/GenerateSnapshotNameStepTests.java @@ -15,7 +15,6 @@ import java.util.Locale; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.elasticsearch.xpack.core.ilm.GenerateSnapshotNameStep.generateSnapshotName; import static org.elasticsearch.xpack.core.ilm.GenerateSnapshotNameStep.validateGeneratedSnapshotName; import static org.hamcrest.Matchers.containsInAnyOrder; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/GenerateUniqueIndexNameStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/GenerateUniqueIndexNameStepTests.java index 78ee9ab12316a..56bf5a934b18c 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/GenerateUniqueIndexNameStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/GenerateUniqueIndexNameStepTests.java @@ -23,7 +23,6 @@ import java.util.Locale; import java.util.function.BiFunction; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.elasticsearch.xpack.core.ilm.GenerateUniqueIndexNameStep.ILLEGAL_INDEXNAME_CHARS_REGEX; import static org.elasticsearch.xpack.core.ilm.GenerateUniqueIndexNameStep.generateValidIndexName; import static org.elasticsearch.xpack.core.ilm.GenerateUniqueIndexNameStep.generateValidIndexSuffix; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStepTests.java index adb07d50663a9..219f7491c8cfa 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/MountSnapshotStepTests.java @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ReplaceDataStreamBackingIndexStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ReplaceDataStreamBackingIndexStepTests.java index f7860fea1f362..2afaa68413158 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ReplaceDataStreamBackingIndexStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ReplaceDataStreamBackingIndexStepTests.java @@ -19,7 +19,6 @@ import java.util.function.BiFunction; import static org.elasticsearch.cluster.metadata.DataStreamTestHelper.createTimestampField; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.hamcrest.Matchers.is; public class ReplaceDataStreamBackingIndexStepTests extends AbstractStepTestCase { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverStepTests.java index 48312831ffb4f..56bb66580efd1 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RolloverStepTests.java @@ -31,7 +31,7 @@ import static org.elasticsearch.cluster.metadata.DataStreamTestHelper.createTimestampField; import static org.mockito.Mockito.verifyZeroInteractions; -public class RolloverStepTests extends AbstractStepMasterTimeoutTestCase { +public class RolloverStepTests extends AbstractStepTestCase { @Override public RolloverStep createRandomInstance() { @@ -73,11 +73,6 @@ private IndexMetadata getIndexMetadata(String alias) { .numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5)).build(); } - @Override - protected IndexMetadata getIndexMetadata() { - return getIndexMetadata(randomAlphaOfLength(5)); - } - private static void assertRolloverIndexRequest(RolloverRequest request, String rolloverTarget) { assertNotNull(request); assertEquals(1, request.indices().length); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RollupStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RollupStepTests.java index a0df63518151b..8fa025389aafc 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RollupStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/RollupStepTests.java @@ -26,7 +26,6 @@ import java.util.Map; import static org.elasticsearch.cluster.metadata.DataStreamTestHelper.createTimestampField; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStepTests.java index 20ac62c85b4ae..e827b236ea36f 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkSetAliasStepTests.java @@ -21,7 +21,6 @@ import java.util.Arrays; import java.util.List; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.elasticsearch.xpack.core.ilm.ShrinkIndexNameSupplier.SHRUNKEN_INDEX_PREFIX; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkStepTests.java index a1f61e175cb7b..94f28f73373fd 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/ShrinkStepTests.java @@ -21,7 +21,6 @@ import java.util.Collections; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.elasticsearch.xpack.core.ilm.LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY; import static org.hamcrest.Matchers.equalTo; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/SwapAliasesAndDeleteSourceIndexStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/SwapAliasesAndDeleteSourceIndexStepTests.java index 74d586b2f4d37..15662c158354d 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/SwapAliasesAndDeleteSourceIndexStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/SwapAliasesAndDeleteSourceIndexStepTests.java @@ -24,7 +24,6 @@ import java.util.Arrays; import java.util.List; -import static org.elasticsearch.xpack.core.ilm.AbstractStepMasterTimeoutTestCase.emptyClusterState; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UpdateRollupIndexPolicyStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UpdateRollupIndexPolicyStepTests.java index 023abaac0a521..61b18fbd56666 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UpdateRollupIndexPolicyStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UpdateRollupIndexPolicyStepTests.java @@ -26,7 +26,7 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; -public class UpdateRollupIndexPolicyStepTests extends AbstractStepMasterTimeoutTestCase { +public class UpdateRollupIndexPolicyStepTests extends AbstractStepTestCase { @Override public UpdateRollupIndexPolicyStep createRandomInstance() { @@ -66,8 +66,7 @@ public UpdateRollupIndexPolicyStep copyInstance(UpdateRollupIndexPolicyStep inst instance.getRollupPolicy()); } - @Override - protected IndexMetadata getIndexMetadata() { + private static IndexMetadata getIndexMetadata() { Map ilmCustom = Collections.singletonMap("rollup_index_name", "rollup-index"); return IndexMetadata.builder(randomAlphaOfLength(10)).settings( settings(Version.CURRENT).put(LifecycleSettings.LIFECYCLE_NAME, "test-ilm-policy")) diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UpdateSettingsStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UpdateSettingsStepTests.java index 606908aa6015d..475764abfa022 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UpdateSettingsStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UpdateSettingsStepTests.java @@ -19,7 +19,7 @@ import static org.hamcrest.Matchers.equalTo; -public class UpdateSettingsStepTests extends AbstractStepMasterTimeoutTestCase { +public class UpdateSettingsStepTests extends AbstractStepTestCase { @Override public UpdateSettingsStep createRandomInstance() { @@ -58,8 +58,7 @@ public UpdateSettingsStep copyInstance(UpdateSettingsStep instance) { return new UpdateSettingsStep(instance.getKey(), instance.getNextStepKey(), instance.getClient(), instance.getSettings()); } - @Override - protected IndexMetadata getIndexMetadata() { + private static IndexMetadata getIndexMetadata() { return IndexMetadata.builder(randomAlphaOfLength(10)).settings(settings(Version.CURRENT)) .numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5)).build(); } diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleRunner.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleRunner.java index 4d18b25d95009..9c2381b0d5faa 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleRunner.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleRunner.java @@ -189,7 +189,7 @@ public void onResponse(boolean conditionMet, ToXContentObject stepInfo) { public void onFailure(Exception e) { moveToErrorStep(indexMetadata.getIndex(), policy, currentStep.getKey(), e); } - }, AsyncActionStep.getMasterTimeout(clusterService.state())); + }, TimeValue.MAX_VALUE); } else { logger.trace("[{}] ignoring non periodic step execution from step transition [{}]", index, currentStep.getKey()); } @@ -220,8 +220,7 @@ void onErrorMaybeRetryFailedStep(String policy, IndexMetadata indexMetadata) { // to move it back into the failed step, so we'll try again clusterService.submitStateUpdateTask( String.format(Locale.ROOT, "ilm-retry-failed-step {policy [%s], index [%s], failedStep [%s]}", policy, index, - failedStep.getKey()), new ClusterStateUpdateTask( - LifecycleSettings.LIFECYCLE_STEP_MASTER_TIMEOUT_SETTING.get(clusterService.state().metadata().settings())) { + failedStep.getKey()), new ClusterStateUpdateTask(TimeValue.MAX_VALUE) { @Override public ClusterState execute(ClusterState currentState) {