From a0ec343d874cb047a13ae224f9e7858a98ad738a Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Wed, 16 Sep 2020 08:10:16 -0600 Subject: [PATCH] Remove data_frozen node role (tier) and frozen ILM phase (#62403) With the differentiation between searchable snapshots on the cold phase and searchable snapshots on the frozen phase not implemented, there is no need to have a separate phase/tier for now. This commit removes the frozen phase and tier, which can be added back at a later time. (this tier was never in a released version, so this is not a breaking change) Relates to #60983 Relates to #60994 Relates to #60848 --- .../ilm/actions/ilm-allocate.asciidoc | 2 +- .../reference/ilm/actions/ilm-freeze.asciidoc | 2 +- .../actions/ilm-searchable-snapshot.asciidoc | 2 +- .../ilm/actions/ilm-set-priority.asciidoc | 2 +- .../ilm/actions/ilm-unfollow.asciidoc | 2 +- .../ilm/ilm-index-lifecycle.asciidoc | 13 +-- .../elasticsearch/xpack/core/DataTier.java | 27 +---- .../elasticsearch/xpack/core/XPackPlugin.java | 3 +- .../core/ilm/TimeseriesLifecycleType.java | 13 +-- .../DataTierAllocationDeciderTests.java | 60 +++++----- .../xpack/core/DataTierTests.java | 10 -- .../xpack/core/ilm/LifecyclePolicyTests.java | 4 - .../ilm/TimeseriesLifecycleTypeTests.java | 110 +----------------- .../xpack/TimeSeriesRestDriver.java | 5 +- 14 files changed, 45 insertions(+), 210 deletions(-) diff --git a/docs/reference/ilm/actions/ilm-allocate.asciidoc b/docs/reference/ilm/actions/ilm-allocate.asciidoc index cbaf5a1a03921..13d1745d3d575 100644 --- a/docs/reference/ilm/actions/ilm-allocate.asciidoc +++ b/docs/reference/ilm/actions/ilm-allocate.asciidoc @@ -2,7 +2,7 @@ [[ilm-allocate]] === Allocate -Phases allowed: warm, cold, frozen. +Phases allowed: warm, cold. Updates the index settings to change which nodes are allowed to host the index shards and change the number of replicas. diff --git a/docs/reference/ilm/actions/ilm-freeze.asciidoc b/docs/reference/ilm/actions/ilm-freeze.asciidoc index d3da5f3ccd0f0..abc5b4ce4a6cc 100644 --- a/docs/reference/ilm/actions/ilm-freeze.asciidoc +++ b/docs/reference/ilm/actions/ilm-freeze.asciidoc @@ -2,7 +2,7 @@ [[ilm-freeze]] === Freeze -Phases allowed: cold, frozen. +Phases allowed: cold. <> an index to minimize its memory footprint. diff --git a/docs/reference/ilm/actions/ilm-searchable-snapshot.asciidoc b/docs/reference/ilm/actions/ilm-searchable-snapshot.asciidoc index 42140338f476f..ea5869696d6c7 100644 --- a/docs/reference/ilm/actions/ilm-searchable-snapshot.asciidoc +++ b/docs/reference/ilm/actions/ilm-searchable-snapshot.asciidoc @@ -2,7 +2,7 @@ [[ilm-searchable-snapshot]] === Searchable snapshot -Phases allowed: cold, frozen. +Phases allowed: cold. Takes a snapshot of the managed index in the configured repository and mounts it as a searchable snapshot. diff --git a/docs/reference/ilm/actions/ilm-set-priority.asciidoc b/docs/reference/ilm/actions/ilm-set-priority.asciidoc index f215f3582ca83..7f22bb64bdba5 100644 --- a/docs/reference/ilm/actions/ilm-set-priority.asciidoc +++ b/docs/reference/ilm/actions/ilm-set-priority.asciidoc @@ -2,7 +2,7 @@ [[ilm-set-priority]] === Set priority -Phases allowed: hot, warm, cold, frozen. +Phases allowed: hot, warm, cold. Sets the <> of the index as soon as the policy enters the hot, warm, or cold phase. diff --git a/docs/reference/ilm/actions/ilm-unfollow.asciidoc b/docs/reference/ilm/actions/ilm-unfollow.asciidoc index d59979e99d6c5..f45c50fd9205e 100644 --- a/docs/reference/ilm/actions/ilm-unfollow.asciidoc +++ b/docs/reference/ilm/actions/ilm-unfollow.asciidoc @@ -2,7 +2,7 @@ [[ilm-unfollow]] === Unfollow -Phases allowed: hot, warm, cold, frozen. +Phases allowed: hot, warm, cold. Converts a {ref}/ccr-apis.html[{ccr-init}] follower index into a regular index. This enables the shrink, rollover, and searchable snapshot actions diff --git a/docs/reference/ilm/ilm-index-lifecycle.asciidoc b/docs/reference/ilm/ilm-index-lifecycle.asciidoc index b93ecdfd096a8..663ad5fef82d9 100644 --- a/docs/reference/ilm/ilm-index-lifecycle.asciidoc +++ b/docs/reference/ilm/ilm-index-lifecycle.asciidoc @@ -6,16 +6,13 @@ Index lifecycle ++++ -{ilm-init} defines five index lifecycle _phases_: +{ilm-init} defines four index lifecycle _phases_: * **Hot**: The index is actively being updated and queried. * **Warm**: The index is no longer being updated but is still being queried. * **Cold**: The index is no longer being updated and is seldom queried. The information still needs to be searchable, but it's okay if those queries are slower. -* **Frozen**: The index is no longer being updated and is seldom queried. The -queries are performing longer-term analyses for which a slower response is -acceptable. * **Delete**: The index is no longer needed and can safely be removed. An index's _lifecycle policy_ specifies which phases @@ -97,14 +94,6 @@ the rollover criteria, it could be 20 minutes before the rollover is complete. ifdef::permanently-unreleased-branch[] - <> endif::[] -* Frozen - - <> - - <> - - <> - - <> -ifdef::permanently-unreleased-branch[] - - <> -endif::[] * Delete - <> - <> diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTier.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTier.java index 5c25c004fe0bb..c997e80b482bc 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTier.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTier.java @@ -20,7 +20,7 @@ /** * The {@code DataTier} class encapsulates the formalization of the "content", - * "hot", "warm", "cold", and "frozen" tiers as node roles. In contains the + * "hot", "warm", and "cold" tiers as node roles. In contains the * roles themselves as well as helpers for validation and determining if a node * has a tier configured. * @@ -33,7 +33,6 @@ public class DataTier { public static final String DATA_HOT = "data_hot"; public static final String DATA_WARM = "data_warm"; public static final String DATA_COLD = "data_cold"; - public static final String DATA_FROZEN = "data_frozen"; /** * Returns true if the given tier name is a valid tier @@ -42,8 +41,7 @@ public static boolean validTierName(String tierName) { return DATA_CONTENT.equals(tierName) || DATA_HOT.equals(tierName) || DATA_WARM.equals(tierName) || - DATA_COLD.equals(tierName) || - DATA_FROZEN.equals(tierName); + DATA_COLD.equals(tierName); } /** @@ -131,23 +129,6 @@ public boolean canContainData() { } }; - public static DiscoveryNodeRole DATA_FROZEN_NODE_ROLE = new DiscoveryNodeRole("data_frozen", "f") { - @Override - public boolean isEnabledByDefault(final Settings settings) { - return false; - } - - @Override - public Setting legacySetting() { - return null; - } - - @Override - public boolean canContainData() { - return true; - } - }; - public static boolean isContentNode(DiscoveryNode discoveryNode) { return discoveryNode.getRoles().contains(DATA_CONTENT_NODE_ROLE) || discoveryNode.getRoles().contains(DiscoveryNodeRole.DATA_ROLE); } @@ -164,10 +145,6 @@ public static boolean isColdNode(DiscoveryNode discoveryNode) { return discoveryNode.getRoles().contains(DATA_COLD_NODE_ROLE) || discoveryNode.getRoles().contains(DiscoveryNodeRole.DATA_ROLE); } - public static boolean isFrozenNode(DiscoveryNode discoveryNode) { - return discoveryNode.getRoles().contains(DATA_FROZEN_NODE_ROLE) || discoveryNode.getRoles().contains(DiscoveryNodeRole.DATA_ROLE); - } - /** * This setting provider injects the setting allocating all newly created indices with * {@code index.routing.allocation.include._tier: "data_hot"} unless the user overrides the diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java index d53584faffbff..17e013533cf41 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackPlugin.java @@ -426,8 +426,7 @@ public Set getRoles() { DataTier.DATA_CONTENT_NODE_ROLE, DataTier.DATA_HOT_NODE_ROLE, DataTier.DATA_WARM_NODE_ROLE, - DataTier.DATA_COLD_NODE_ROLE, - DataTier.DATA_FROZEN_NODE_ROLE)); + DataTier.DATA_COLD_NODE_ROLE)); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleType.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleType.java index c23143aecda0d..5a4991796d6e8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleType.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleType.java @@ -34,22 +34,18 @@ public class TimeseriesLifecycleType implements LifecycleType { static final String HOT_PHASE = "hot"; static final String WARM_PHASE = "warm"; static final String COLD_PHASE = "cold"; - static final String FROZEN_PHASE = "frozen"; static final String DELETE_PHASE = "delete"; - static final List VALID_PHASES = Arrays.asList(HOT_PHASE, WARM_PHASE, COLD_PHASE, FROZEN_PHASE, DELETE_PHASE); + static final List VALID_PHASES = Arrays.asList(HOT_PHASE, WARM_PHASE, COLD_PHASE, DELETE_PHASE); static final List ORDERED_VALID_HOT_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, RolloverAction.NAME, ForceMergeAction.NAME); static final List ORDERED_VALID_WARM_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, ReadOnlyAction.NAME, AllocateAction.NAME, ShrinkAction.NAME, ForceMergeAction.NAME); static final List ORDERED_VALID_COLD_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, AllocateAction.NAME, FreezeAction.NAME, SearchableSnapshotAction.NAME); - static final List ORDERED_VALID_FROZEN_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, AllocateAction.NAME, - FreezeAction.NAME, SearchableSnapshotAction.NAME); static final List ORDERED_VALID_DELETE_ACTIONS = Arrays.asList(WaitForSnapshotAction.NAME, DeleteAction.NAME); static final Set VALID_HOT_ACTIONS = Sets.newHashSet(ORDERED_VALID_HOT_ACTIONS); static final Set VALID_WARM_ACTIONS = Sets.newHashSet(ORDERED_VALID_WARM_ACTIONS); static final Set VALID_COLD_ACTIONS = Sets.newHashSet(ORDERED_VALID_COLD_ACTIONS); - static final Set VALID_FROZEN_ACTIONS = Sets.newHashSet(ORDERED_VALID_FROZEN_ACTIONS); static final Set VALID_DELETE_ACTIONS = Sets.newHashSet(ORDERED_VALID_DELETE_ACTIONS); private static Map> ALLOWED_ACTIONS = new HashMap<>(); @@ -57,7 +53,6 @@ public class TimeseriesLifecycleType implements LifecycleType { ALLOWED_ACTIONS.put(HOT_PHASE, VALID_HOT_ACTIONS); ALLOWED_ACTIONS.put(WARM_PHASE, VALID_WARM_ACTIONS); ALLOWED_ACTIONS.put(COLD_PHASE, VALID_COLD_ACTIONS); - ALLOWED_ACTIONS.put(FROZEN_PHASE, VALID_FROZEN_ACTIONS); ALLOWED_ACTIONS.put(DELETE_PHASE, VALID_DELETE_ACTIONS); } @@ -146,9 +141,6 @@ public List getOrderedActions(Phase phase) { case COLD_PHASE: return ORDERED_VALID_COLD_ACTIONS.stream().map(a -> actions.getOrDefault(a, null)) .filter(Objects::nonNull).collect(Collectors.toList()); - case FROZEN_PHASE: - return ORDERED_VALID_FROZEN_ACTIONS.stream().map(a -> actions.getOrDefault(a, null)) - .filter(Objects::nonNull).collect(Collectors.toList()); case DELETE_PHASE: return ORDERED_VALID_DELETE_ACTIONS.stream().map(a -> actions.getOrDefault(a, null)) .filter(Objects::nonNull).collect(Collectors.toList()); @@ -170,9 +162,6 @@ public String getNextActionName(String currentActionName, Phase phase) { case COLD_PHASE: orderedActionNames = ORDERED_VALID_COLD_ACTIONS; break; - case FROZEN_PHASE: - orderedActionNames = ORDERED_VALID_FROZEN_ACTIONS; - break; case DELETE_PHASE: orderedActionNames = ORDERED_VALID_DELETE_ACTIONS; break; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/cluster/routing/allocation/DataTierAllocationDeciderTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/cluster/routing/allocation/DataTierAllocationDeciderTests.java index bedbcdeecca3e..dde91120cede9 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/cluster/routing/allocation/DataTierAllocationDeciderTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/cluster/routing/allocation/DataTierAllocationDeciderTests.java @@ -47,7 +47,6 @@ public class DataTierAllocationDeciderTests extends ESAllocationTestCase { private static final DiscoveryNode HOT_NODE = newNode("node-hot", Collections.singleton(DataTier.DATA_HOT_NODE_ROLE)); private static final DiscoveryNode WARM_NODE = newNode("node-warm", Collections.singleton(DataTier.DATA_WARM_NODE_ROLE)); private static final DiscoveryNode COLD_NODE = newNode("node-cold", Collections.singleton(DataTier.DATA_COLD_NODE_ROLE)); - private static final DiscoveryNode FROZEN_NODE = newNode("node-frozen", Collections.singleton(DataTier.DATA_FROZEN_NODE_ROLE)); private static final DiscoveryNode DATA_NODE = newNode("node-data", Collections.singleton(DiscoveryNodeRole.DATA_ROLE)); private final ClusterSettings clusterSettings = new ClusterSettings(Settings.EMPTY, ALL_SETTINGS); @@ -89,7 +88,7 @@ public void testClusterRequires() { assertThat(d.type(), equalTo(Decision.Type.YES)); } - for (DiscoveryNode n : Arrays.asList(WARM_NODE, COLD_NODE, FROZEN_NODE)) { + for (DiscoveryNode n : Arrays.asList(WARM_NODE, COLD_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); @@ -110,12 +109,12 @@ public void testClusterIncludes() { null, 0); allocation.debugDecision(true); clusterSettings.applySettings(Settings.builder() - .put(DataTierAllocationDecider.CLUSTER_ROUTING_INCLUDE, "data_warm,data_frozen") + .put(DataTierAllocationDecider.CLUSTER_ROUTING_INCLUDE, "data_warm,data_cold") .build()); Decision d; RoutingNode node; - for (DiscoveryNode n : Arrays.asList(WARM_NODE, FROZEN_NODE, DATA_NODE)) { + for (DiscoveryNode n : Arrays.asList(WARM_NODE, DATA_NODE, COLD_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.YES)); @@ -123,18 +122,18 @@ public void testClusterIncludes() { assertThat(d.type(), equalTo(Decision.Type.YES)); } - for (DiscoveryNode n : Arrays.asList(HOT_NODE, COLD_NODE)) { + for (DiscoveryNode n : Arrays.asList(HOT_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), containsString("node does not match any cluster setting [cluster.routing.allocation.include._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm,data_cold]")); d = decider.canRemain(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), containsString("node does not match any cluster setting [cluster.routing.allocation.include._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm,data_cold]")); } } @@ -145,23 +144,23 @@ public void testClusterExcludes() { null, 0); allocation.debugDecision(true); clusterSettings.applySettings(Settings.builder() - .put(DataTierAllocationDecider.CLUSTER_ROUTING_EXCLUDE, "data_warm,data_frozen") + .put(DataTierAllocationDecider.CLUSTER_ROUTING_EXCLUDE, "data_warm") .build()); Decision d; RoutingNode node; - for (DiscoveryNode n : Arrays.asList(WARM_NODE, FROZEN_NODE, DATA_NODE)) { + for (DiscoveryNode n : Arrays.asList(WARM_NODE, DATA_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), containsString("node matches any cluster setting [cluster.routing.allocation.exclude._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm]")); d = decider.canRemain(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), containsString("node matches any cluster setting [cluster.routing.allocation.exclude._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm]")); } @@ -193,7 +192,7 @@ public void testIndexRequires() { assertThat(d.type(), equalTo(Decision.Type.YES)); } - for (DiscoveryNode n : Arrays.asList(WARM_NODE, COLD_NODE, FROZEN_NODE)) { + for (DiscoveryNode n : Arrays.asList(WARM_NODE, COLD_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); @@ -209,7 +208,7 @@ public void testIndexRequires() { public void testIndexIncludes() { ClusterState state = prepareState(service.reroute(ClusterState.EMPTY_STATE, "initial state"), Settings.builder() - .put(DataTierAllocationDecider.INDEX_ROUTING_INCLUDE, "data_warm,data_frozen") + .put(DataTierAllocationDecider.INDEX_ROUTING_INCLUDE, "data_warm,data_cold") .build()); RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, state.getRoutingNodes(), state, null, 0); @@ -217,7 +216,7 @@ public void testIndexIncludes() { Decision d; RoutingNode node; - for (DiscoveryNode n : Arrays.asList(WARM_NODE, FROZEN_NODE, DATA_NODE)) { + for (DiscoveryNode n : Arrays.asList(WARM_NODE, DATA_NODE, COLD_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.YES)); @@ -225,25 +224,25 @@ public void testIndexIncludes() { assertThat(d.type(), equalTo(Decision.Type.YES)); } - for (DiscoveryNode n : Arrays.asList(HOT_NODE, COLD_NODE)) { + for (DiscoveryNode n : Arrays.asList(HOT_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), containsString("node does not match any index setting [index.routing.allocation.include._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm,data_cold]")); d = decider.canRemain(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), containsString("node does not match any index setting [index.routing.allocation.include._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm,data_cold]")); } } public void testIndexExcludes() { ClusterState state = prepareState(service.reroute(ClusterState.EMPTY_STATE, "initial state"), Settings.builder() - .put(DataTierAllocationDecider.INDEX_ROUTING_EXCLUDE, "data_warm,data_frozen") + .put(DataTierAllocationDecider.INDEX_ROUTING_EXCLUDE, "data_warm,data_cold") .build()); RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, state.getRoutingNodes(), state, null, 0); @@ -251,22 +250,22 @@ public void testIndexExcludes() { Decision d; RoutingNode node; - for (DiscoveryNode n : Arrays.asList(WARM_NODE, FROZEN_NODE, DATA_NODE)) { + for (DiscoveryNode n : Arrays.asList(WARM_NODE, DATA_NODE, COLD_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), containsString("node matches any index setting [index.routing.allocation.exclude._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm,data_cold]")); d = decider.canRemain(shard, node, allocation); assertThat(d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), containsString("node matches any index setting [index.routing.allocation.exclude._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm,data_cold]")); } - for (DiscoveryNode n : Arrays.asList(HOT_NODE, COLD_NODE)) { + for (DiscoveryNode n : Arrays.asList(HOT_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(n.toString(), d.type(), equalTo(Decision.Type.YES)); @@ -278,41 +277,41 @@ public void testIndexExcludes() { public void testClusterAndIndex() { ClusterState state = prepareState(service.reroute(ClusterState.EMPTY_STATE, "initial state"), Settings.builder() - .put(DataTierAllocationDecider.INDEX_ROUTING_INCLUDE, "data_warm,data_frozen") + .put(DataTierAllocationDecider.INDEX_ROUTING_INCLUDE, "data_warm,data_cold") .build()); RoutingAllocation allocation = new RoutingAllocation(allocationDeciders, state.getRoutingNodes(), state, null, 0); clusterSettings.applySettings(Settings.builder() - .put(DataTierAllocationDecider.CLUSTER_ROUTING_EXCLUDE, "data_frozen") + .put(DataTierAllocationDecider.CLUSTER_ROUTING_EXCLUDE, "data_cold") .build()); allocation.debugDecision(true); Decision d; RoutingNode node; - for (DiscoveryNode n : Arrays.asList(HOT_NODE, COLD_NODE)) { + for (DiscoveryNode n : Arrays.asList(HOT_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(node.toString(), d.type(), equalTo(Decision.Type.NO)); assertThat(node.toString(), d.getExplanation(), containsString("node does not match any index setting [index.routing.allocation.include._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm,data_cold]")); d = decider.canRemain(shard, node, allocation); assertThat(node.toString(), d.type(), equalTo(Decision.Type.NO)); assertThat(node.toString(), d.getExplanation(), containsString("node does not match any index setting [index.routing.allocation.include._tier] " + - "tier filters [data_warm,data_frozen]")); + "tier filters [data_warm,data_cold]")); } - for (DiscoveryNode n : Arrays.asList(FROZEN_NODE, DATA_NODE)) { + for (DiscoveryNode n : Arrays.asList(DATA_NODE)) { node = new RoutingNode(n.getId(), n, shard); d = decider.canAllocate(shard, node, allocation); assertThat(node.toString(), d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), - containsString("node matches any cluster setting [cluster.routing.allocation.exclude._tier] tier filters [data_frozen]")); + containsString("node matches any cluster setting [cluster.routing.allocation.exclude._tier] tier filters [data_cold]")); d = decider.canRemain(shard, node, allocation); assertThat(node.toString(), d.type(), equalTo(Decision.Type.NO)); assertThat(d.getExplanation(), - containsString("node matches any cluster setting [cluster.routing.allocation.exclude._tier] tier filters [data_frozen]")); + containsString("node matches any cluster setting [cluster.routing.allocation.exclude._tier] tier filters [data_cold]")); } for (DiscoveryNode n : Arrays.asList(WARM_NODE)) { @@ -334,7 +333,6 @@ private ClusterState prepareState(ClusterState initialState, Settings indexSetti .add(HOT_NODE) .add(WARM_NODE) .add(COLD_NODE) - .add(FROZEN_NODE) .add(DATA_NODE) .build()) .metadata(Metadata.builder() diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/DataTierTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/DataTierTests.java index 0fc9437ebda27..368d82da203bf 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/DataTierTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/DataTierTests.java @@ -68,24 +68,15 @@ public void testNodeSelection() { .map(DiscoveryNode::getId) .toArray(String[]::new); - final String[] frozenNodes = - StreamSupport.stream(discoveryNodes.getNodes().values().spliterator(), false) - .map(n -> n.value) - .filter(DataTier::isFrozenNode) - .map(DiscoveryNode::getId) - .toArray(String[]::new); - assertThat(discoveryNodes.resolveNodes("data:true"), arrayContainingInAnyOrder(dataNodes)); assertThat(discoveryNodes.resolveNodes("data_content:true"), arrayContainingInAnyOrder(contentNodes)); assertThat(discoveryNodes.resolveNodes("data_hot:true"), arrayContainingInAnyOrder(hotNodes)); assertThat(discoveryNodes.resolveNodes("data_warm:true"), arrayContainingInAnyOrder(warmNodes)); assertThat(discoveryNodes.resolveNodes("data_cold:true"), arrayContainingInAnyOrder(coldNodes)); - assertThat(discoveryNodes.resolveNodes("data_frozen:true"), arrayContainingInAnyOrder(frozenNodes)); Set allTiers = new HashSet<>(Arrays.asList(contentNodes)); allTiers.addAll(Arrays.asList(hotNodes)); allTiers.addAll(Arrays.asList(warmNodes)); allTiers.addAll(Arrays.asList(coldNodes)); - allTiers.addAll(Arrays.asList(frozenNodes)); assertThat(discoveryNodes.resolveNodes("data:true"), arrayContainingInAnyOrder(allTiers.toArray(Strings.EMPTY_ARRAY))); } @@ -113,7 +104,6 @@ private static List randomNodes(final int numNodes) { allRoles.add(DataTier.DATA_HOT_NODE_ROLE); allRoles.add(DataTier.DATA_WARM_NODE_ROLE); allRoles.add(DataTier.DATA_COLD_NODE_ROLE); - allRoles.add(DataTier.DATA_FROZEN_NODE_ROLE); List nodesList = new ArrayList<>(); for (int i = 0; i < numNodes; i++) { Map attributes = new HashMap<>(); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicyTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicyTests.java index 5e9142c0520ba..308c3df20d0bd 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicyTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/LifecyclePolicyTests.java @@ -105,8 +105,6 @@ public static LifecyclePolicy randomTimeseriesLifecyclePolicyWithAllPhases(@Null return TimeseriesLifecycleType.VALID_WARM_ACTIONS; case "cold": return TimeseriesLifecycleType.VALID_COLD_ACTIONS; - case "frozen": - return TimeseriesLifecycleType.VALID_FROZEN_ACTIONS; case "delete": return TimeseriesLifecycleType.VALID_DELETE_ACTIONS; default: @@ -163,8 +161,6 @@ public static LifecyclePolicy randomTimeseriesLifecyclePolicy(@Nullable String l return TimeseriesLifecycleType.VALID_WARM_ACTIONS; case "cold": return TimeseriesLifecycleType.VALID_COLD_ACTIONS; - case "frozen": - return TimeseriesLifecycleType.VALID_FROZEN_ACTIONS; case "delete": return TimeseriesLifecycleType.VALID_DELETE_ACTIONS; default: diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleTypeTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleTypeTests.java index 9096bf242bfc2..f8962ce43b56f 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleTypeTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleTypeTests.java @@ -22,12 +22,10 @@ import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.ORDERED_VALID_COLD_ACTIONS; import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.ORDERED_VALID_DELETE_ACTIONS; -import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.ORDERED_VALID_FROZEN_ACTIONS; import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.ORDERED_VALID_HOT_ACTIONS; import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.ORDERED_VALID_WARM_ACTIONS; import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.VALID_COLD_ACTIONS; import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.VALID_DELETE_ACTIONS; -import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.VALID_FROZEN_ACTIONS; import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.VALID_HOT_ACTIONS; import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.VALID_PHASES; import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.VALID_WARM_ACTIONS; @@ -51,7 +49,7 @@ public class TimeseriesLifecycleTypeTests extends ESTestCase { public void testValidatePhases() { boolean invalid = randomBoolean(); - String phaseName = randomFrom("hot", "warm", "cold", "frozen", "delete"); + String phaseName = randomFrom("hot", "warm", "cold", "delete"); if (invalid) { phaseName += randomAlphaOfLength(5); } @@ -144,27 +142,6 @@ public void testValidateColdPhase() { } } - public void testValidateFrozenPhase() { - LifecycleAction invalidAction = null; - Map actions = randomSubsetOf(VALID_FROZEN_ACTIONS) - .stream().map(this::getTestAction).collect(Collectors.toMap(LifecycleAction::getWriteableName, Function.identity())); - if (randomBoolean()) { - invalidAction = getTestAction(randomFrom("rollover", "delete", "forcemerge", "shrink")); - actions.put(invalidAction.getWriteableName(), invalidAction); - } - Map frozenPhase = Collections.singletonMap("frozen", - new Phase("frozen", TimeValue.ZERO, actions)); - - if (invalidAction != null) { - Exception e = expectThrows(IllegalArgumentException.class, - () -> TimeseriesLifecycleType.INSTANCE.validate(frozenPhase.values())); - assertThat(e.getMessage(), - equalTo("invalid action [" + invalidAction.getWriteableName() + "] defined in phase [frozen]")); - } else { - TimeseriesLifecycleType.INSTANCE.validate(frozenPhase.values()); - } - } - public void testValidateDeletePhase() { LifecycleAction invalidAction = null; Map actions = VALID_DELETE_ACTIONS @@ -256,15 +233,6 @@ public void testGetOrderedActionsCold() { assertThat(orderedActions.indexOf(TEST_PRIORITY_ACTION), equalTo(0)); } - public void testGetOrderedActionsFrozen() { - Map actions = VALID_FROZEN_ACTIONS - .stream().map(this::getTestAction).collect(Collectors.toMap(LifecycleAction::getWriteableName, Function.identity())); - Phase frozenPhase = new Phase("frozen", TimeValue.ZERO, actions); - List orderedActions = TimeseriesLifecycleType.INSTANCE.getOrderedActions(frozenPhase); - assertTrue(isSorted(orderedActions, LifecycleAction::getWriteableName, ORDERED_VALID_FROZEN_ACTIONS)); - assertThat(orderedActions.indexOf(TEST_PRIORITY_ACTION), equalTo(0)); - } - public void testGetOrderedActionsDelete() { Map actions = VALID_DELETE_ACTIONS .stream().map(this::getTestAction).collect(Collectors.toMap(LifecycleAction::getWriteableName, Function.identity())); @@ -276,25 +244,21 @@ public void testGetOrderedActionsDelete() { public void testGetNextPhaseName() { assertNextPhaseName("hot", "warm", new String[] { "hot", "warm" }); assertNextPhaseName("hot", "warm", new String[] { "hot", "warm", "cold" }); - assertNextPhaseName("hot", "warm", new String[] { "hot", "warm", "cold", "frozen"}); - assertNextPhaseName("hot", "warm", new String[] { "hot", "warm", "cold", "frozen", "delete" }); + assertNextPhaseName("hot", "warm", new String[] { "hot", "warm", "cold", "delete"}); assertNextPhaseName("hot", "warm", new String[] { "warm", "cold", "delete" }); assertNextPhaseName("hot", "warm", new String[] { "warm", "cold", "delete" }); assertNextPhaseName("hot", "warm", new String[] { "warm", "delete" }); assertNextPhaseName("hot", "cold", new String[] { "cold", "delete" }); assertNextPhaseName("hot", "cold", new String[] { "cold" }); - assertNextPhaseName("hot", "frozen", new String[] { "hot", "frozen" }); - assertNextPhaseName("hot", "frozen", new String[] { "frozen" }); assertNextPhaseName("hot", "delete", new String[] { "hot", "delete" }); assertNextPhaseName("hot", "delete", new String[] { "delete" }); assertNextPhaseName("hot", null, new String[] { "hot" }); assertNextPhaseName("hot", null, new String[] {}); - assertNextPhaseName("warm", "cold", new String[] { "hot", "warm", "cold", "frozen", "delete" }); + assertNextPhaseName("warm", "cold", new String[] { "hot", "warm", "cold", "delete" }); assertNextPhaseName("warm", "cold", new String[] { "warm", "cold", "delete" }); assertNextPhaseName("warm", "cold", new String[] { "cold", "delete" }); assertNextPhaseName("warm", "cold", new String[] { "cold" }); - assertNextPhaseName("warm", "frozen", new String[] { "hot", "warm", "frozen", "delete" }); assertNextPhaseName("warm", "delete", new String[] { "hot", "warm", "delete" }); assertNextPhaseName("warm", null, new String[] { "hot", "warm" }); assertNextPhaseName("warm", null, new String[] { "warm" }); @@ -306,34 +270,18 @@ public void testGetNextPhaseName() { assertNextPhaseName("cold", "delete", new String[] { "cold", "delete" }); assertNextPhaseName("cold", "delete", new String[] { "delete" }); assertNextPhaseName("cold", "delete", new String[] { "hot", "warm", "delete" }); - assertNextPhaseName("cold", "frozen", new String[] { "cold", "frozen", "delete" }); - assertNextPhaseName("cold", "frozen", new String[] { "hot", "warm", "frozen", "delete" }); assertNextPhaseName("cold", null, new String[] { "hot", "warm", "cold" }); assertNextPhaseName("cold", null, new String[] { "hot", "warm" }); assertNextPhaseName("cold", null, new String[] { "cold" }); assertNextPhaseName("cold", null, new String[] { "hot" }); assertNextPhaseName("cold", null, new String[] {}); - assertNextPhaseName("frozen", "delete", new String[] { "hot", "warm", "cold", "delete" }); - assertNextPhaseName("frozen", "delete", new String[] { "warm", "cold", "delete" }); - assertNextPhaseName("frozen", "delete", new String[] { "cold", "delete" }); - assertNextPhaseName("frozen", "delete", new String[] { "delete" }); - assertNextPhaseName("frozen", "delete", new String[] { "frozen", "delete" }); - assertNextPhaseName("frozen", "delete", new String[] { "hot", "warm", "delete" }); - assertNextPhaseName("frozen", null, new String[] { "hot", "warm", "cold" }); - assertNextPhaseName("frozen", null, new String[] { "hot", "warm" }); - assertNextPhaseName("frozen", null, new String[] { "cold" }); - assertNextPhaseName("frozen", null, new String[] { "hot" }); - assertNextPhaseName("frozen", null, new String[] { "frozen" }); - assertNextPhaseName("frozen", null, new String[] {}); - - assertNextPhaseName("delete", null, new String[] { "hot", "warm", "cold", "frozen" }); + assertNextPhaseName("delete", null, new String[] { "hot", "warm", "cold" }); assertNextPhaseName("delete", null, new String[] { "hot", "warm" }); assertNextPhaseName("delete", null, new String[] { "cold" }); assertNextPhaseName("delete", null, new String[] { "hot" }); - assertNextPhaseName("delete", null, new String[] { "frozen" }); assertNextPhaseName("delete", null, new String[] {}); - assertNextPhaseName("delete", null, new String[] { "hot", "warm", "cold", "frozen", "delete" }); + assertNextPhaseName("delete", null, new String[] { "hot", "warm", "cold", "delete" }); assertNextPhaseName("delete", null, new String[] { "hot", "warm", "delete" }); assertNextPhaseName("delete", null, new String[] { "cold", "delete" }); assertNextPhaseName("delete", null, new String[] { "delete" }); @@ -382,30 +330,14 @@ public void testGetPreviousPhaseName() { assertPreviousPhaseName("cold", "warm", new String[] { "warm" }); assertPreviousPhaseName("cold", null, new String[] {}); - assertPreviousPhaseName("frozen", "warm", new String[] { "hot", "warm", "frozen", "delete" }); - assertPreviousPhaseName("frozen", "hot", new String[] { "hot", "frozen", "delete" }); - assertPreviousPhaseName("frozen", "warm", new String[] { "warm", "frozen", "delete" }); - assertPreviousPhaseName("frozen", "cold", new String[] { "cold", "frozen", "delete" }); - assertPreviousPhaseName("frozen", null, new String[] { "frozen", "delete" }); - assertPreviousPhaseName("frozen", "warm", new String[] { "hot", "warm", "delete" }); - assertPreviousPhaseName("frozen", "hot", new String[] { "hot", "delete" }); - assertPreviousPhaseName("frozen", "warm", new String[] { "warm", "delete" }); - assertPreviousPhaseName("frozen", null, new String[] { "delete" }); - assertPreviousPhaseName("frozen", "warm", new String[] { "hot", "warm" }); - assertPreviousPhaseName("frozen", "hot", new String[] { "hot" }); - assertPreviousPhaseName("frozen", "warm", new String[] { "warm" }); - assertPreviousPhaseName("frozen", null, new String[] {}); - assertPreviousPhaseName("delete", "cold", new String[] { "hot", "warm", "cold", "delete" }); assertPreviousPhaseName("delete", "cold", new String[] { "warm", "cold", "delete" }); assertPreviousPhaseName("delete", "warm", new String[] { "hot", "warm", "delete" }); assertPreviousPhaseName("delete", "hot", new String[] { "hot", "delete" }); assertPreviousPhaseName("delete", "cold", new String[] { "cold", "delete" }); - assertPreviousPhaseName("delete", "frozen", new String[] { "frozen", "delete" }); assertPreviousPhaseName("delete", null, new String[] { "delete" }); assertPreviousPhaseName("delete", "cold", new String[] { "hot", "warm", "cold" }); assertPreviousPhaseName("delete", "cold", new String[] { "warm", "cold" }); - assertPreviousPhaseName("delete", "frozen", new String[] { "warm", "frozen" }); assertPreviousPhaseName("delete", "warm", new String[] { "hot", "warm" }); assertPreviousPhaseName("delete", "hot", new String[] { "hot" }); assertPreviousPhaseName("delete", "cold", new String[] { "cold" }); @@ -537,38 +469,6 @@ public void testGetNextActionName() { assertInvalidAction("cold", RolloverAction.NAME, new String[] { AllocateAction.NAME }); assertInvalidAction("cold", ShrinkAction.NAME, new String[] { AllocateAction.NAME }); - // Frozen Phase - assertNextActionName("frozen", SetPriorityAction.NAME, UnfollowAction.NAME, - new String[]{UnfollowAction.NAME, SetPriorityAction.NAME, FreezeAction.NAME}); - assertNextActionName("frozen", SetPriorityAction.NAME, FreezeAction.NAME, - new String[]{SetPriorityAction.NAME, FreezeAction.NAME}); - assertNextActionName("frozen", SetPriorityAction.NAME, AllocateAction.NAME, - new String[]{SetPriorityAction.NAME, AllocateAction.NAME}); - assertNextActionName("frozen", SetPriorityAction.NAME, null, new String[] { SetPriorityAction.NAME }); - assertNextActionName("frozen", SetPriorityAction.NAME, null, new String[] {}); - - assertNextActionName("frozen", UnfollowAction.NAME, AllocateAction.NAME, - new String[] {SetPriorityAction.NAME, AllocateAction.NAME, FreezeAction.NAME}); - assertNextActionName("frozen", UnfollowAction.NAME, AllocateAction.NAME, - new String[] {AllocateAction.NAME, FreezeAction.NAME}); - assertNextActionName("frozen", UnfollowAction.NAME, FreezeAction.NAME, new String[] {FreezeAction.NAME}); - assertNextActionName("frozen", UnfollowAction.NAME, null, new String[] {}); - - assertNextActionName("frozen", AllocateAction.NAME, null, new String[] { AllocateAction.NAME }); - assertNextActionName("frozen", AllocateAction.NAME, null, new String[] {}); - assertNextActionName("frozen", AllocateAction.NAME, null, new String[] {}); - assertNextActionName("frozen", AllocateAction.NAME, FreezeAction.NAME, FreezeAction.NAME); - - assertNextActionName("frozen", FreezeAction.NAME, null); - assertNextActionName("frozen", FreezeAction.NAME, null, AllocateAction.NAME); - - assertInvalidAction("frozen", "foo", new String[] { AllocateAction.NAME }); - assertInvalidAction("frozen", DeleteAction.NAME, new String[] { AllocateAction.NAME }); - assertInvalidAction("frozen", ForceMergeAction.NAME, new String[] { AllocateAction.NAME }); - assertInvalidAction("frozen", ReadOnlyAction.NAME, new String[] { AllocateAction.NAME }); - assertInvalidAction("frozen", RolloverAction.NAME, new String[] { AllocateAction.NAME }); - assertInvalidAction("frozen", ShrinkAction.NAME, new String[] { AllocateAction.NAME }); - // Delete Phase assertNextActionName("delete", DeleteAction.NAME, null, new String[] {}); assertNextActionName("delete", DeleteAction.NAME, null, new String[] { DeleteAction.NAME }); diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java index 043a66948b4aa..13f80368f3e2c 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/TimeSeriesRestDriver.java @@ -159,15 +159,12 @@ public static void createFullPolicy(RestClient client, String policyName, TimeVa warmActions.put(AllocateAction.NAME, new AllocateAction(1, singletonMap("_name", "javaRestTest-1,javaRestTest-2"), null, null)); warmActions.put(ShrinkAction.NAME, new ShrinkAction(1)); Map coldActions = new HashMap<>(); - coldActions.put(SetPriorityAction.NAME, new SetPriorityAction(25)); + coldActions.put(SetPriorityAction.NAME, new SetPriorityAction(0)); coldActions.put(AllocateAction.NAME, new AllocateAction(0, singletonMap("_name", "javaRestTest-3"), null, null)); - Map frozenActions = new HashMap<>(); - frozenActions.put(SetPriorityAction.NAME, new SetPriorityAction(0)); Map phases = new HashMap<>(); phases.put("hot", new Phase("hot", hotTime, hotActions)); phases.put("warm", new Phase("warm", TimeValue.ZERO, warmActions)); phases.put("cold", new Phase("cold", TimeValue.ZERO, coldActions)); - phases.put("frozen", new Phase("frozen", TimeValue.ZERO, frozenActions)); phases.put("delete", new Phase("delete", TimeValue.ZERO, singletonMap(DeleteAction.NAME, new DeleteAction()))); LifecyclePolicy lifecyclePolicy = new LifecyclePolicy(policyName, phases); // PUT policy