[7.x] Remove data_frozen node role (tier) and frozen ILM phase (#62403) (#62465)

Backports the following commits to 7.x:

    Remove data_frozen node role (tier) and frozen ILM phase (#62403)
This commit is contained in:
Lee Hinman 2020-09-17 08:58:07 -06:00 committed by GitHub
parent fe1194d58f
commit a636d106bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 45 additions and 210 deletions

View File

@ -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.

View File

@ -2,7 +2,7 @@
[[ilm-freeze]]
=== Freeze
Phases allowed: cold, frozen.
Phases allowed: cold.
<<frozen-indices, Freezes>> an index to minimize its memory footprint.

View File

@ -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.

View File

@ -2,7 +2,7 @@
[[ilm-set-priority]]
=== Set priority
Phases allowed: hot, warm, cold, frozen.
Phases allowed: hot, warm, cold.
Sets the <<recovery-prioritization, priority>> of the index as
soon as the policy enters the hot, warm, or cold phase.

View File

@ -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

View File

@ -6,16 +6,13 @@
<titleabbrev>Index lifecycle</titleabbrev>
++++
{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[]
- <<ilm-searchable-snapshot, Searchable Snapshot>>
endif::[]
* Frozen
- <<ilm-set-priority-action,Set Priority>>
- <<ilm-unfollow-action,Unfollow>>
- <<ilm-allocate,Allocate>>
- <<ilm-freeze,Freeze>>
ifdef::permanently-unreleased-branch[]
- <<ilm-searchable-snapshot, Searchable Snapshot>>
endif::[]
* Delete
- <<ilm-wait-for-snapshot-action,Wait For Snapshot>>
- <<ilm-delete,Delete>>

View File

@ -20,7 +20,7 @@ import java.util.Set;
/**
* 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 class DataTier {
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 class DataTier {
}
};
public static DiscoveryNodeRole DATA_FROZEN_NODE_ROLE = new DiscoveryNodeRole("data_frozen", "f") {
@Override
public boolean isEnabledByDefault(final Settings settings) {
return false;
}
@Override
public Setting<Boolean> 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 class DataTier {
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

View File

@ -426,8 +426,7 @@ public class XPackPlugin extends XPackClientPlugin implements ExtensiblePlugin,
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

View File

@ -37,22 +37,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<String> VALID_PHASES = Arrays.asList(HOT_PHASE, WARM_PHASE, COLD_PHASE, FROZEN_PHASE, DELETE_PHASE);
static final List<String> VALID_PHASES = Arrays.asList(HOT_PHASE, WARM_PHASE, COLD_PHASE, DELETE_PHASE);
static final List<String> ORDERED_VALID_HOT_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, RolloverAction.NAME,
ForceMergeAction.NAME);
static final List<String> ORDERED_VALID_WARM_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, ReadOnlyAction.NAME,
AllocateAction.NAME, MigrateAction.NAME, ShrinkAction.NAME, ForceMergeAction.NAME);
static final List<String> ORDERED_VALID_COLD_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, AllocateAction.NAME,
MigrateAction.NAME, FreezeAction.NAME, SearchableSnapshotAction.NAME);
static final List<String> ORDERED_VALID_FROZEN_ACTIONS = Arrays.asList(SetPriorityAction.NAME, UnfollowAction.NAME, AllocateAction.NAME,
FreezeAction.NAME, SearchableSnapshotAction.NAME);
static final List<String> ORDERED_VALID_DELETE_ACTIONS = Arrays.asList(WaitForSnapshotAction.NAME, DeleteAction.NAME);
static final Set<String> VALID_HOT_ACTIONS = Sets.newHashSet(ORDERED_VALID_HOT_ACTIONS);
static final Set<String> VALID_WARM_ACTIONS = Sets.newHashSet(ORDERED_VALID_WARM_ACTIONS);
static final Set<String> VALID_COLD_ACTIONS = Sets.newHashSet(ORDERED_VALID_COLD_ACTIONS);
static final Set<String> VALID_FROZEN_ACTIONS = Sets.newHashSet(ORDERED_VALID_FROZEN_ACTIONS);
static final Set<String> VALID_DELETE_ACTIONS = Sets.newHashSet(ORDERED_VALID_DELETE_ACTIONS);
private static final Map<String, Set<String>> ALLOWED_ACTIONS = new HashMap<>();
@ -60,7 +56,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);
}
@ -170,9 +165,6 @@ public class TimeseriesLifecycleType implements LifecycleType {
case COLD_PHASE:
return ORDERED_VALID_COLD_ACTIONS.stream().map(a -> actions.getOrDefault(a, null))
.filter(Objects::nonNull).collect(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(toList());
@ -194,9 +186,6 @@ public class TimeseriesLifecycleType implements LifecycleType {
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;

View File

@ -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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 class DataTierAllocationDeciderTests extends ESAllocationTestCase {
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 @@ public class DataTierAllocationDeciderTests extends ESAllocationTestCase {
.add(HOT_NODE)
.add(WARM_NODE)
.add(COLD_NODE)
.add(FROZEN_NODE)
.add(DATA_NODE)
.build())
.metadata(Metadata.builder()

View File

@ -68,24 +68,15 @@ public class DataTierTests extends ESTestCase {
.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<String> 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 @@ public class DataTierTests extends ESTestCase {
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<DiscoveryNode> nodesList = new ArrayList<>();
for (int i = 0; i < numNodes; i++) {
Map<String, String> attributes = new HashMap<>();

View File

@ -107,8 +107,6 @@ public class LifecyclePolicyTests extends AbstractSerializingTestCase<LifecycleP
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:
@ -167,8 +165,6 @@ public class LifecyclePolicyTests extends AbstractSerializingTestCase<LifecycleP
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:

View File

@ -24,12 +24,10 @@ import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.COLD_PHAS
import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleType.HOT_PHASE;
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;
@ -59,7 +57,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);
}
@ -152,27 +150,6 @@ public class TimeseriesLifecycleTypeTests extends ESTestCase {
}
}
public void testValidateFrozenPhase() {
LifecycleAction invalidAction = null;
Map<String, LifecycleAction> 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<String, Phase> 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<String, LifecycleAction> actions = VALID_DELETE_ACTIONS
@ -298,15 +275,6 @@ public class TimeseriesLifecycleTypeTests extends ESTestCase {
assertThat(orderedActions.indexOf(TEST_PRIORITY_ACTION), equalTo(0));
}
public void testGetOrderedActionsFrozen() {
Map<String, LifecycleAction> actions = VALID_FROZEN_ACTIONS
.stream().map(this::getTestAction).collect(Collectors.toMap(LifecycleAction::getWriteableName, Function.identity()));
Phase frozenPhase = new Phase("frozen", TimeValue.ZERO, actions);
List<LifecycleAction> 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<String, LifecycleAction> actions = VALID_DELETE_ACTIONS
.stream().map(this::getTestAction).collect(Collectors.toMap(LifecycleAction::getWriteableName, Function.identity()));
@ -318,25 +286,21 @@ public class TimeseriesLifecycleTypeTests extends ESTestCase {
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" });
@ -348,34 +312,18 @@ public class TimeseriesLifecycleTypeTests extends ESTestCase {
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" });
@ -424,30 +372,14 @@ public class TimeseriesLifecycleTypeTests extends ESTestCase {
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" });
@ -579,38 +511,6 @@ public class TimeseriesLifecycleTypeTests extends ESTestCase {
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 });

View File

@ -159,15 +159,12 @@ public final class TimeSeriesRestDriver {
warmActions.put(AllocateAction.NAME, new AllocateAction(1, singletonMap("_name", "javaRestTest-1,javaRestTest-2"), null, null));
warmActions.put(ShrinkAction.NAME, new ShrinkAction(1));
Map<String, LifecycleAction> 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<String, LifecycleAction> frozenActions = new HashMap<>();
frozenActions.put(SetPriorityAction.NAME, new SetPriorityAction(0));
Map<String, Phase> 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