Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
andreidan committed Jul 19, 2023
1 parent 8775cfb commit 823dafb
Show file tree
Hide file tree
Showing 3 changed files with 313 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,29 @@
public final class TimeseriesLifecycleActionsRegistry {

public static final int VERSION_ONE = 1;
public static final int CURRENT_VERSION = VERSION_ONE;
// moves the downsample action after the migrate action in the warm and cold phases
public static final int VERSION_TWO = 2;
public static final int CURRENT_VERSION = VERSION_TWO;

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";
public static final String HOT_PHASE = "hot";
public static final String WARM_PHASE = "warm";
public static final String COLD_PHASE = "cold";
public static final String FROZEN_PHASE = "frozen";
public static final String DELETE_PHASE = "delete";

public static final Map<Integer, List<String>> ORDERED_VALID_HOT_ACTIONS = Map.of(
VERSION_ONE,
Stream.of(
SetPriorityAction.NAME,
UnfollowAction.NAME,
RolloverAction.NAME,
ReadOnlyAction.NAME,
DownsampleAction.NAME,
ShrinkAction.NAME,
ForceMergeAction.NAME,
SearchableSnapshotAction.NAME
).filter(Objects::nonNull).toList(),
VERSION_TWO,
Stream.of(
SetPriorityAction.NAME,
UnfollowAction.NAME,
Expand All @@ -57,6 +70,17 @@ public final class TimeseriesLifecycleActionsRegistry {
MigrateAction.NAME,
ShrinkAction.NAME,
ForceMergeAction.NAME
).filter(Objects::nonNull).toList(),
VERSION_TWO,
Stream.of(
SetPriorityAction.NAME,
UnfollowAction.NAME,
ReadOnlyAction.NAME,
AllocateAction.NAME,
MigrateAction.NAME,
DownsampleAction.NAME,
ShrinkAction.NAME,
ForceMergeAction.NAME
).filter(Objects::nonNull).toList()
);

Expand All @@ -71,15 +95,30 @@ public final class TimeseriesLifecycleActionsRegistry {
AllocateAction.NAME,
MigrateAction.NAME,
FreezeAction.NAME
).filter(Objects::nonNull).toList(),
VERSION_TWO,
Stream.of(
SetPriorityAction.NAME,
UnfollowAction.NAME,
ReadOnlyAction.NAME,
SearchableSnapshotAction.NAME,
AllocateAction.NAME,
MigrateAction.NAME,
DownsampleAction.NAME,
FreezeAction.NAME
).filter(Objects::nonNull).toList()
);

public static final Map<Integer, List<String>> ORDERED_VALID_FROZEN_ACTIONS = Map.of(
VERSION_ONE,
List.of(UnfollowAction.NAME, SearchableSnapshotAction.NAME),
VERSION_TWO,
List.of(UnfollowAction.NAME, SearchableSnapshotAction.NAME)
);
public static final Map<Integer, List<String>> ORDERED_VALID_DELETE_ACTIONS = Map.of(
VERSION_ONE,
List.of(WaitForSnapshotAction.NAME, DeleteAction.NAME),
VERSION_TWO,
List.of(WaitForSnapshotAction.NAME, DeleteAction.NAME)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.awaitLatch;
import static org.elasticsearch.xpack.core.ilm.LifecycleSettings.LIFECYCLE_HISTORY_INDEX_ENABLED_SETTING;
import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleActionsRegistry.CURRENT_VERSION;
import static org.elasticsearch.xpack.core.ilm.TimeseriesLifecycleActionsRegistry.VERSION_ONE;
import static org.elasticsearch.xpack.ilm.LifecyclePolicyTestsUtils.newTestLifecyclePolicy;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
Expand Down Expand Up @@ -1249,10 +1250,12 @@ public static MockPolicyStepsRegistry createMultiStepPolicyStepRegistry(String p
SortedMap<String, LifecyclePolicyMetadata> lifecyclePolicyMap = new TreeMap<>();
lifecyclePolicyMap.put(policyName, new LifecyclePolicyMetadata(policy, new HashMap<>(), 1, 1));
Map<VersionedPolicyKey, Step> firstStepMap = new HashMap<>();
firstStepMap.put(new VersionedPolicyKey(VERSION_ONE, policyName), steps.get(0));
firstStepMap.put(new VersionedPolicyKey(CURRENT_VERSION, policyName), steps.get(0));
Map<VersionedPolicyKey, Map<StepKey, Step>> stepMap = new HashMap<>();
Map<StepKey, Step> policySteps = new HashMap<>();
steps.forEach(step -> policySteps.put(step.getKey(), step));
stepMap.put(new VersionedPolicyKey(VERSION_ONE, policyName), policySteps);
stepMap.put(new VersionedPolicyKey(CURRENT_VERSION, policyName), policySteps);
Client client = mock(Client.class);
when(client.settings()).thenReturn(Settings.EMPTY);
Expand Down
Loading

0 comments on commit 823dafb

Please sign in to comment.