Skip to content

Commit 160bdab

Browse files
authored
Removing the reindex data stream feature flag (#120677)
1 parent 3d43498 commit 160bdab

File tree

10 files changed

+55
-128
lines changed

10 files changed

+55
-128
lines changed

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/FeatureFlag.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public enum FeatureFlag {
1919
TIME_SERIES_MODE("es.index_mode_feature_flag_registered=true", Version.fromString("8.0.0"), null),
2020
FAILURE_STORE_ENABLED("es.failure_store_feature_flag_enabled=true", Version.fromString("8.12.0"), null),
2121
SUB_OBJECTS_AUTO_ENABLED("es.sub_objects_auto_feature_flag_enabled=true", Version.fromString("8.16.0"), null),
22-
INFERENCE_UNIFIED_API_ENABLED("es.inference_unified_feature_flag_enabled=true", Version.fromString("8.18.0"), null),
23-
MIGRATION_REINDEX_ENABLED("es.reindex_data_stream_feature_flag_enabled=true", Version.fromString("8.18.0"), null);
22+
INFERENCE_UNIFIED_API_ENABLED("es.inference_unified_feature_flag_enabled=true", Version.fromString("8.18.0"), null);
2423

2524
public final String systemProperty;
2625
public final Version from;

x-pack/plugin/migrate/src/internalClusterTest/java/org/elasticsearch/xpack/migrate/action/CreateIndexFromSourceActionIT.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.util.Map;
3333

3434
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
35-
import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction.REINDEX_DATA_STREAM_FEATURE_FLAG;
3635

3736
public class CreateIndexFromSourceActionIT extends ESIntegTestCase {
3837

@@ -42,8 +41,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
4241
}
4342

4443
public void testOldSettingsManuallyFiltered() throws Exception {
45-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
46-
4744
var numShards = randomIntBetween(1, 10);
4845
var staticSettings = Settings.builder()
4946
// setting to filter
@@ -77,8 +74,6 @@ public void testOldSettingsManuallyFiltered() throws Exception {
7774
}
7875

7976
public void testDestIndexCreated() throws Exception {
80-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
81-
8277
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
8378
indicesAdmin().create(new CreateIndexRequest(sourceIndex)).get();
8479

@@ -96,8 +91,6 @@ public void testDestIndexCreated() throws Exception {
9691
}
9792

9893
public void testSettingsCopiedFromSource() throws Exception {
99-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
100-
10194
// start with a static setting
10295
var numShards = randomIntBetween(1, 10);
10396
var staticSettings = Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards).build();
@@ -122,8 +115,6 @@ public void testSettingsCopiedFromSource() throws Exception {
122115
}
123116

124117
public void testMappingsCopiedFromSource() {
125-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
126-
127118
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
128119
String mapping = """
129120
{
@@ -157,8 +148,6 @@ public void testMappingsCopiedFromSource() {
157148
}
158149

159150
public void testSettingsOverridden() throws Exception {
160-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
161-
162151
var numShardsSource = randomIntBetween(1, 10);
163152
var numReplicasSource = randomIntBetween(0, 10);
164153
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
@@ -191,8 +180,6 @@ public void testSettingsOverridden() throws Exception {
191180
}
192181

193182
public void testSettingsNullOverride() throws Exception {
194-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
195-
196183
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
197184
var sourceSettings = Settings.builder()
198185
.put(IndexMetadata.SETTING_BLOCKS_WRITE, true)
@@ -223,8 +210,6 @@ public void testSettingsNullOverride() throws Exception {
223210
}
224211

225212
public void testRemoveIndexBlocksByDefault() throws Exception {
226-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
227-
228213
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
229214

230215
var sourceSettings = Settings.builder()
@@ -257,8 +242,6 @@ public void testRemoveIndexBlocksByDefault() throws Exception {
257242
}
258243

259244
public void testMappingsOverridden() {
260-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
261-
262245
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
263246
String sourceMapping = """
264247
{

x-pack/plugin/migrate/src/internalClusterTest/java/org/elasticsearch/xpack/migrate/action/ReindexDataStreamTransportActionIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import java.util.concurrent.CountDownLatch;
4141
import java.util.concurrent.atomic.AtomicReference;
4242

43-
import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction.REINDEX_DATA_STREAM_FEATURE_FLAG;
4443
import static org.hamcrest.Matchers.equalTo;
4544
import static org.hamcrest.Matchers.is;
4645

@@ -52,7 +51,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
5251
}
5352

5453
public void testNonExistentDataStream() {
55-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
5654
String nonExistentDataStreamName = randomAlphaOfLength(50);
5755
ReindexDataStreamRequest reindexDataStreamRequest = new ReindexDataStreamRequest(
5856
ReindexDataStreamAction.Mode.UPGRADE,
@@ -65,7 +63,6 @@ public void testNonExistentDataStream() {
6563
}
6664

6765
public void testAlreadyUpToDateDataStream() throws Exception {
68-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
6966
String dataStreamName = randomAlphaOfLength(50).toLowerCase(Locale.ROOT);
7067
ReindexDataStreamRequest reindexDataStreamRequest = new ReindexDataStreamRequest(
7168
ReindexDataStreamAction.Mode.UPGRADE,

x-pack/plugin/migrate/src/internalClusterTest/java/org/elasticsearch/xpack/migrate/action/ReindexDatastreamIndexTransportActionIT.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
5454
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
5555
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
56-
import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction.REINDEX_DATA_STREAM_FEATURE_FLAG;
5756
import static org.hamcrest.Matchers.equalTo;
5857

5958
public class ReindexDatastreamIndexTransportActionIT extends ESIntegTestCase {
@@ -77,8 +76,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
7776
}
7877

7978
public void testDestIndexDeletedIfExists() throws Exception {
80-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
81-
8279
// empty source index
8380
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
8481
indicesAdmin().create(new CreateIndexRequest(sourceIndex)).get();
@@ -99,8 +96,6 @@ public void testDestIndexDeletedIfExists() throws Exception {
9996
}
10097

10198
public void testDestIndexNameSet_noDotPrefix() throws Exception {
102-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
103-
10499
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
105100
indicesAdmin().create(new CreateIndexRequest(sourceIndex)).get();
106101

@@ -113,7 +108,6 @@ public void testDestIndexNameSet_noDotPrefix() throws Exception {
113108
}
114109

115110
public void testDestIndexNameSet_withDotPrefix() throws Exception {
116-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
117111

118112
var sourceIndex = "." + randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
119113
indicesAdmin().create(new CreateIndexRequest(sourceIndex)).get();
@@ -127,8 +121,6 @@ public void testDestIndexNameSet_withDotPrefix() throws Exception {
127121
}
128122

129123
public void testDestIndexContainsDocs() throws Exception {
130-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
131-
132124
// source index with docs
133125
var numDocs = randomIntBetween(1, 100);
134126
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
@@ -145,8 +137,6 @@ public void testDestIndexContainsDocs() throws Exception {
145137
}
146138

147139
public void testSetSourceToBlockWrites() throws Exception {
148-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
149-
150140
var settings = randomBoolean() ? Settings.builder().put(IndexMetadata.SETTING_BLOCKS_WRITE, true).build() : Settings.EMPTY;
151141

152142
// empty source index
@@ -163,8 +153,6 @@ public void testSetSourceToBlockWrites() throws Exception {
163153
}
164154

165155
public void testSettingsAddedBeforeReindex() throws Exception {
166-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
167-
168156
// start with a static setting
169157
var numShards = randomIntBetween(1, 10);
170158
var staticSettings = Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, numShards).build();
@@ -193,8 +181,6 @@ public void testSettingsAddedBeforeReindex() throws Exception {
193181
}
194182

195183
public void testMappingsAddedToDestIndex() throws Exception {
196-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
197-
198184
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
199185
indicesAdmin().create(new CreateIndexRequest(sourceIndex).mapping(MAPPING)).actionGet();
200186

@@ -215,8 +201,6 @@ public void testMappingsAddedToDestIndex() throws Exception {
215201
}
216202

217203
public void testFailIfMetadataBlockSet() {
218-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
219-
220204
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
221205
var settings = Settings.builder().put(IndexMetadata.SETTING_BLOCKS_METADATA, true).build();
222206
indicesAdmin().create(new CreateIndexRequest(sourceIndex, settings)).actionGet();
@@ -231,8 +215,6 @@ public void testFailIfMetadataBlockSet() {
231215
}
232216

233217
public void testFailIfReadBlockSet() {
234-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
235-
236218
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
237219
var settings = Settings.builder().put(IndexMetadata.SETTING_BLOCKS_READ, true).build();
238220
indicesAdmin().create(new CreateIndexRequest(sourceIndex, settings)).actionGet();
@@ -247,8 +229,6 @@ public void testFailIfReadBlockSet() {
247229
}
248230

249231
public void testReadOnlyBlocksNotAddedBack() {
250-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
251-
252232
var sourceIndex = randomAlphaOfLength(20).toLowerCase(Locale.ROOT);
253233
var settings = Settings.builder()
254234
.put(IndexMetadata.SETTING_READ_ONLY, randomBoolean())
@@ -272,8 +252,6 @@ public void testReadOnlyBlocksNotAddedBack() {
272252
}
273253

274254
public void testUpdateSettingsDefaultsRestored() {
275-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
276-
277255
// ESIntegTestCase creates a template random_index_template which contains a value for number_of_replicas.
278256
// Since this test checks the behavior of default settings, there cannot be a value for number_of_replicas,
279257
// so we delete the template within this method. This has no effect on other tests which will still
@@ -304,8 +282,6 @@ public void testUpdateSettingsDefaultsRestored() {
304282
}
305283

306284
public void testSettingsAndMappingsFromTemplate() throws IOException {
307-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
308-
309285
var numShards = randomIntBetween(1, 10);
310286
var numReplicas = randomIntBetween(0, 10);
311287

@@ -393,8 +369,6 @@ public void testSettingsAndMappingsFromTemplate() throws IOException {
393369
""";
394370

395371
public void testTsdbStartEndSet() throws Exception {
396-
assumeTrue("requires the migration reindex feature flag", REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled());
397-
398372
var templateSettings = Settings.builder().put("index.mode", "time_series");
399373
if (randomBoolean()) {
400374
templateSettings.put("index.routing_path", "metricset");

x-pack/plugin/migrate/src/main/java/org/elasticsearch/xpack/migrate/MigratePlugin.java

Lines changed: 42 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import java.util.function.Supplier;
6161

6262
import static org.elasticsearch.xpack.core.ClientHelper.REINDEX_DATA_STREAM_ORIGIN;
63-
import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction.REINDEX_DATA_STREAM_FEATURE_FLAG;
6463
import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamIndexTransportAction.REINDEX_MAX_REQUESTS_PER_SECOND_SETTING;
6564
import static org.elasticsearch.xpack.migrate.task.ReindexDataStreamPersistentTaskExecutor.MAX_CONCURRENT_INDICES_REINDEXED_PER_DATA_STREAM_SETTING;
6665

@@ -79,67 +78,55 @@ public List<RestHandler> getRestHandlers(
7978
Predicate<NodeFeature> clusterSupportsFeature
8079
) {
8180
List<RestHandler> handlers = new ArrayList<>();
82-
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
83-
handlers.add(new RestMigrationReindexAction());
84-
handlers.add(new RestGetMigrationReindexStatusAction());
85-
handlers.add(new RestCancelReindexDataStreamAction());
86-
handlers.add(new RestCreateIndexFromSourceAction());
87-
}
81+
handlers.add(new RestMigrationReindexAction());
82+
handlers.add(new RestGetMigrationReindexStatusAction());
83+
handlers.add(new RestCancelReindexDataStreamAction());
84+
handlers.add(new RestCreateIndexFromSourceAction());
8885
return handlers;
8986
}
9087

9188
@Override
9289
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
9390
List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> actions = new ArrayList<>();
94-
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
95-
actions.add(new ActionHandler<>(ReindexDataStreamAction.INSTANCE, ReindexDataStreamTransportAction.class));
96-
actions.add(new ActionHandler<>(GetMigrationReindexStatusAction.INSTANCE, GetMigrationReindexStatusTransportAction.class));
97-
actions.add(new ActionHandler<>(CancelReindexDataStreamAction.INSTANCE, CancelReindexDataStreamTransportAction.class));
98-
actions.add(new ActionHandler<>(ReindexDataStreamIndexAction.INSTANCE, ReindexDataStreamIndexTransportAction.class));
99-
actions.add(new ActionHandler<>(CreateIndexFromSourceAction.INSTANCE, CreateIndexFromSourceTransportAction.class));
100-
}
91+
actions.add(new ActionHandler<>(ReindexDataStreamAction.INSTANCE, ReindexDataStreamTransportAction.class));
92+
actions.add(new ActionHandler<>(GetMigrationReindexStatusAction.INSTANCE, GetMigrationReindexStatusTransportAction.class));
93+
actions.add(new ActionHandler<>(CancelReindexDataStreamAction.INSTANCE, CancelReindexDataStreamTransportAction.class));
94+
actions.add(new ActionHandler<>(ReindexDataStreamIndexAction.INSTANCE, ReindexDataStreamIndexTransportAction.class));
95+
actions.add(new ActionHandler<>(CreateIndexFromSourceAction.INSTANCE, CreateIndexFromSourceTransportAction.class));
10196
return actions;
10297
}
10398

10499
@Override
105100
public List<NamedXContentRegistry.Entry> getNamedXContent() {
106-
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
107-
return List.of(
108-
new NamedXContentRegistry.Entry(
109-
PersistentTaskState.class,
110-
new ParseField(ReindexDataStreamPersistentTaskState.NAME),
111-
ReindexDataStreamPersistentTaskState::fromXContent
112-
),
113-
new NamedXContentRegistry.Entry(
114-
PersistentTaskParams.class,
115-
new ParseField(ReindexDataStreamTaskParams.NAME),
116-
ReindexDataStreamTaskParams::fromXContent
117-
)
118-
);
119-
} else {
120-
return List.of();
121-
}
101+
return List.of(
102+
new NamedXContentRegistry.Entry(
103+
PersistentTaskState.class,
104+
new ParseField(ReindexDataStreamPersistentTaskState.NAME),
105+
ReindexDataStreamPersistentTaskState::fromXContent
106+
),
107+
new NamedXContentRegistry.Entry(
108+
PersistentTaskParams.class,
109+
new ParseField(ReindexDataStreamTaskParams.NAME),
110+
ReindexDataStreamTaskParams::fromXContent
111+
)
112+
);
122113
}
123114

124115
@Override
125116
public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
126-
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
127-
return List.of(
128-
new NamedWriteableRegistry.Entry(
129-
PersistentTaskState.class,
130-
ReindexDataStreamPersistentTaskState.NAME,
131-
ReindexDataStreamPersistentTaskState::new
132-
),
133-
new NamedWriteableRegistry.Entry(
134-
PersistentTaskParams.class,
135-
ReindexDataStreamTaskParams.NAME,
136-
ReindexDataStreamTaskParams::new
137-
),
138-
new NamedWriteableRegistry.Entry(Task.Status.class, ReindexDataStreamStatus.NAME, ReindexDataStreamStatus::new)
139-
);
140-
} else {
141-
return List.of();
142-
}
117+
return List.of(
118+
new NamedWriteableRegistry.Entry(
119+
PersistentTaskState.class,
120+
ReindexDataStreamPersistentTaskState.NAME,
121+
ReindexDataStreamPersistentTaskState::new
122+
),
123+
new NamedWriteableRegistry.Entry(
124+
PersistentTaskParams.class,
125+
ReindexDataStreamTaskParams.NAME,
126+
ReindexDataStreamTaskParams::new
127+
),
128+
new NamedWriteableRegistry.Entry(Task.Status.class, ReindexDataStreamStatus.NAME, ReindexDataStreamStatus::new)
129+
);
143130
}
144131

145132
@Override
@@ -150,18 +137,14 @@ public List<PersistentTasksExecutor<?>> getPersistentTasksExecutor(
150137
SettingsModule settingsModule,
151138
IndexNameExpressionResolver expressionResolver
152139
) {
153-
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
154-
return List.of(
155-
new ReindexDataStreamPersistentTaskExecutor(
156-
new OriginSettingClient(client, REINDEX_DATA_STREAM_ORIGIN),
157-
clusterService,
158-
ReindexDataStreamTask.TASK_NAME,
159-
threadPool
160-
)
161-
);
162-
} else {
163-
return List.of();
164-
}
140+
return List.of(
141+
new ReindexDataStreamPersistentTaskExecutor(
142+
new OriginSettingClient(client, REINDEX_DATA_STREAM_ORIGIN),
143+
clusterService,
144+
ReindexDataStreamTask.TASK_NAME,
145+
threadPool
146+
)
147+
);
165148
}
166149

167150
@Override

x-pack/plugin/migrate/src/main/java/org/elasticsearch/xpack/migrate/action/ReindexDataStreamAction.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import org.elasticsearch.action.support.master.AcknowledgedResponse;
1616
import org.elasticsearch.common.io.stream.StreamInput;
1717
import org.elasticsearch.common.io.stream.StreamOutput;
18-
import org.elasticsearch.common.util.FeatureFlag;
1918
import org.elasticsearch.features.NodeFeature;
2019
import org.elasticsearch.xcontent.ConstructingObjectParser;
2120
import org.elasticsearch.xcontent.ParseField;
@@ -29,7 +28,6 @@
2928
import java.util.function.Predicate;
3029

3130
public class ReindexDataStreamAction extends ActionType<AcknowledgedResponse> {
32-
public static final FeatureFlag REINDEX_DATA_STREAM_FEATURE_FLAG = new FeatureFlag("reindex_data_stream");
3331
public static final String TASK_ID_PREFIX = "reindex-data-stream-";
3432

3533
public static final ReindexDataStreamAction INSTANCE = new ReindexDataStreamAction();

0 commit comments

Comments
 (0)