Skip to content
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f4a37a9
Enable the _tier attribute as a node filter
andreidan Aug 20, 2020
024a0de
ILM: inject a migrate step to migrate data between data tiers
andreidan Aug 20, 2020
ca9800f
Merge branch 'master' into ilm-migrate-data-between-tiers
andreidan Sep 1, 2020
07dc8de
Add a DataTierMigrationRoutedStep and cleanup
andreidan Sep 3, 2020
42900b2
Fix tests
andreidan Sep 4, 2020
5d6729b
Fix test
andreidan Sep 4, 2020
28ccee9
Remove invalid tier name setting validation from ILM step
andreidan Sep 4, 2020
45d2eb3
Add test for DataTierMigrationRoutedStep
andreidan Sep 4, 2020
6c05591
Disable data tier migration in the full policy we use for timeseries ITS
andreidan Sep 4, 2020
783061d
Remove unused import
andreidan Sep 4, 2020
ab3ac33
Revert "Disable data tier migration in the full policy we use for tim…
andreidan Sep 6, 2020
6b74d7c
Add MigrateActionTest
andreidan Sep 6, 2020
61ed9eb
Merge branch 'master' into ilm-migrate-data-between-tiers
elasticmachine Sep 6, 2020
6f83f91
Don't randomly pick a disabled migrate action as it has no steps
andreidan Sep 7, 2020
4bef9b2
Add ILM tier migratino IT
andreidan Sep 7, 2020
5024595
Use 0 replicas in docs test as `check-migration` waits for replicas t…
andreidan Sep 7, 2020
41dc480
Fix ILMHistoryTests
andreidan Sep 7, 2020
d9b6390
Merge branch 'master' into ilm-migrate-data-between-tiers
elasticmachine Sep 7, 2020
8e9a4f3
Disable migrate action in test that waits for shard allocations
andreidan Sep 7, 2020
996c747
Add ILM client MigrateAction
andreidan Sep 7, 2020
83c31b6
Remove unused import
andreidan Sep 7, 2020
c1746d4
Fix HLRC tests
andreidan Sep 7, 2020
fe1fb8f
Add tests for conflicting auto allocate to hot nodes and MigrateActio…
andreidan Sep 7, 2020
e435a2f
Use valid tier name in test
andreidan Sep 7, 2020
656afe5
Implement hashcode
andreidan Sep 8, 2020
a24b0fc
Merge branch 'master' into ilm-migrate-data-between-tiers
andreidan Sep 8, 2020
8d806e2
Make method static
andreidan Sep 8, 2020
2133715
Check for "data" role in `check-migration` step
andreidan Sep 10, 2020
991fdc0
Document AllocationInfo and rename `actual_replicas` to `number_of_re…
andreidan Sep 10, 2020
be65929
Disallow the migrate action in the hot phase
andreidan Sep 10, 2020
39b518e
Remove rogue ;
andreidan Sep 10, 2020
f3a64d3
Fix HLRC tests
andreidan Sep 10, 2020
d119797
Merge branch 'master' into ilm-migrate-data-between-tiers
elasticmachine Sep 10, 2020
8f855c5
Fix ILMHistoryTests
andreidan Sep 10, 2020
0636d0e
Merge branch 'master' into ilm-migrate-data-between-tiers
elasticmachine Sep 14, 2020
500a275
Merge branch 'master' into ilm-migrate-data-between-tiers
elasticmachine Sep 16, 2020
9b90555
Remove frozen phase from HLRC
andreidan Sep 16, 2020
eddd223
Execute the allocate action before migrate
andreidan Sep 16, 2020
d733d72
Adjust test to wait until ILM completes in the cold phase
andreidan Sep 16, 2020
4da7379
Log and exception messages
andreidan Sep 16, 2020
be17159
Merge branch 'master' into ilm-migrate-data-between-tiers
andreidan Sep 16, 2020
b837718
Drop equals and hashcode (in favour of the ones in Step)
andreidan Sep 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public List<NamedXContentRegistry.Entry> getNamedXContentParsers() {
new NamedXContentRegistry.Entry(LifecycleAction.class,
new ParseField(SetPriorityAction.NAME),
SetPriorityAction::parse),
new NamedXContentRegistry.Entry(LifecycleAction.class,
new ParseField(MigrateAction.NAME),
MigrateAction::parse),
new NamedXContentRegistry.Entry(LifecycleAction.class,
new ParseField(UnfollowAction.NAME),
UnfollowAction::parse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ public class LifecyclePolicy implements ToXContentObject {
}, PHASES_FIELD);

ALLOWED_ACTIONS.put("hot", Sets.newHashSet(UnfollowAction.NAME, SetPriorityAction.NAME, RolloverAction.NAME));
ALLOWED_ACTIONS.put("warm", Sets.newHashSet(UnfollowAction.NAME, SetPriorityAction.NAME, AllocateAction.NAME, ForceMergeAction.NAME,
ReadOnlyAction.NAME, ShrinkAction.NAME));
ALLOWED_ACTIONS.put("cold", Sets.newHashSet(UnfollowAction.NAME, SetPriorityAction.NAME, AllocateAction.NAME, FreezeAction.NAME));
ALLOWED_ACTIONS.put("warm", Sets.newHashSet(UnfollowAction.NAME, SetPriorityAction.NAME, MigrateAction.NAME, AllocateAction.NAME,
ForceMergeAction.NAME, ReadOnlyAction.NAME, ShrinkAction.NAME));
ALLOWED_ACTIONS.put("cold", Sets.newHashSet(UnfollowAction.NAME, SetPriorityAction.NAME, MigrateAction.NAME, AllocateAction.NAME,
FreezeAction.NAME));
ALLOWED_ACTIONS.put("frozen", Sets.newHashSet(UnfollowAction.NAME, SetPriorityAction.NAME, MigrateAction.NAME, AllocateAction.NAME,
FreezeAction.NAME));
ALLOWED_ACTIONS.put("delete", Sets.newHashSet(DeleteAction.NAME));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client.ilm;

import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;

import java.io.IOException;
import java.util.Objects;

public class MigrateAction implements LifecycleAction, ToXContentObject {
public static final String NAME = "migrate";

public static final ParseField ENABLED_FIELD = new ParseField("enabled");

private static final ConstructingObjectParser<MigrateAction, Void> PARSER = new ConstructingObjectParser<>(NAME,
a -> new MigrateAction(a[0] == null ? true : (boolean) a[0]));

static {
PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), ENABLED_FIELD);
}

public static MigrateAction parse(XContentParser parser) {
return PARSER.apply(parser, null);
}

private final boolean enabled;

public MigrateAction() {
this(true);
}

public MigrateAction(boolean enabled) {
this.enabled = enabled;
}

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(ENABLED_FIELD.getPreferredName(), enabled);
builder.endObject();
return builder;
}

@Override
public String getName() {
return NAME;
}

@Override
public int hashCode() {
return Objects.hashCode(enabled);
}

@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj.getClass() != getClass()) {
return false;
}
return true;
}

@Override
public String toString() {
return Strings.toString(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ public void testDefaultNamedXContents() {

public void testProvidedNamedXContents() {
List<NamedXContentRegistry.Entry> namedXContents = RestHighLevelClient.getProvidedNamedXContents();
assertEquals(70, namedXContents.size());
assertEquals(71, namedXContents.size());
Map<Class<?>, Integer> categories = new HashMap<>();
List<String> names = new ArrayList<>();
for (NamedXContentRegistry.Entry namedXContent : namedXContents) {
Expand All @@ -731,7 +731,7 @@ public void testProvidedNamedXContents() {
assertTrue(names.contains(MeanReciprocalRank.NAME));
assertTrue(names.contains(DiscountedCumulativeGain.NAME));
assertTrue(names.contains(ExpectedReciprocalRank.NAME));
assertEquals(Integer.valueOf(9), categories.get(LifecycleAction.class));
assertEquals(Integer.valueOf(10), categories.get(LifecycleAction.class));
assertTrue(names.contains(UnfollowAction.NAME));
assertTrue(names.contains(AllocateAction.NAME));
assertTrue(names.contains(DeleteAction.NAME));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ public void testExplainLifecycle() throws Exception {
CreateIndexRequest createIndexRequest = new CreateIndexRequest("my_index-1")
.settings(Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.put("index.lifecycle.name", "my_policy")
.put("index.lifecycle.rollover_alias", "my_alias")
.build());
Expand All @@ -370,6 +371,7 @@ public void testExplainLifecycle() throws Exception {
CreateIndexRequest createOtherIndexRequest = new CreateIndexRequest("other_index")
.settings(Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.build());
client.indices().create(createOtherIndexRequest, RequestOptions.DEFAULT);

Expand Down Expand Up @@ -624,6 +626,7 @@ public void testRetryPolicy() throws Exception {
CreateIndexRequest createIndexRequest = new CreateIndexRequest("my_index")
.settings(Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 2)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.put("index.lifecycle.name", "my_policy")
.build());
client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
Expand Down Expand Up @@ -689,6 +692,7 @@ public void testRemovePolicyFromIndex() throws Exception {
CreateIndexRequest createIndexRequest = new CreateIndexRequest("my_index")
.settings(Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.put("index.lifecycle.name", "my_policy")
.build());
client.indices().create(createIndexRequest, RequestOptions.DEFAULT);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client.ilm;

import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractXContentTestCase;

import java.io.IOException;

public class MigrateActionTests extends AbstractXContentTestCase<MigrateAction> {

@Override
protected MigrateAction doParseInstance(XContentParser parser) throws IOException {
return MigrateAction.parse(parser);
}

@Override
protected MigrateAction createTestInstance() {
return randomInstance();
}

static MigrateAction randomInstance() {
return new MigrateAction(randomBoolean());
}

@Override
protected boolean supportsUnknownFields() {
return false;
}
}
2 changes: 1 addition & 1 deletion docs/reference/ilm/apis/explain.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ information for the step that's being performed on the index.
"message": "Waiting for all shard copies to be active",
"shards_left_to_allocate": -1,
"all_shards_active": false,
"actual_replicas": 2
"number_of_replicas": 2
},
"phase_execution": {
"policy": "my_lifecycle3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.elasticsearch.xpack.core.ilm.IndexLifecycleMetadata;
import org.elasticsearch.xpack.core.ilm.LifecycleAction;
import org.elasticsearch.xpack.core.ilm.LifecycleType;
import org.elasticsearch.xpack.core.ilm.MigrateAction;
import org.elasticsearch.xpack.core.ilm.ReadOnlyAction;
import org.elasticsearch.xpack.core.ilm.RolloverAction;
import org.elasticsearch.xpack.core.ilm.SearchableSnapshotAction;
Expand Down Expand Up @@ -484,6 +485,7 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
new NamedWriteableRegistry.Entry(LifecycleAction.class, UnfollowAction.NAME, UnfollowAction::new),
new NamedWriteableRegistry.Entry(LifecycleAction.class, WaitForSnapshotAction.NAME, WaitForSnapshotAction::new),
new NamedWriteableRegistry.Entry(LifecycleAction.class, SearchableSnapshotAction.NAME, SearchableSnapshotAction::new),
new NamedWriteableRegistry.Entry(LifecycleAction.class, MigrateAction.NAME, MigrateAction::new),
// Transforms
new NamedWriteableRegistry.Entry(XPackFeatureSet.Usage.class, XPackField.TRANSFORM, TransformFeatureSetUsage::new),
new NamedWriteableRegistry.Entry(PersistentTaskParams.class, TransformField.TASK_NAME, TransformTaskParams::new),
Expand Down
Loading