Skip to content

Commit

Permalink
Removing the reindex data stream feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke committed Jan 22, 2025
1 parent d7c2320 commit 2462b76
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public enum FeatureFlag {
TIME_SERIES_MODE("es.index_mode_feature_flag_registered=true", Version.fromString("8.0.0"), null),
FAILURE_STORE_ENABLED("es.failure_store_feature_flag_enabled=true", Version.fromString("8.12.0"), null),
SUB_OBJECTS_AUTO_ENABLED("es.sub_objects_auto_feature_flag_enabled=true", Version.fromString("8.16.0"), null),
INFERENCE_UNIFIED_API_ENABLED("es.inference_unified_feature_flag_enabled=true", Version.fromString("8.18.0"), null),
MIGRATION_REINDEX_ENABLED("es.reindex_data_stream_feature_flag_enabled=true", Version.fromString("8.18.0"), null);
INFERENCE_UNIFIED_API_ENABLED("es.inference_unified_feature_flag_enabled=true", Version.fromString("8.18.0"), null);

public final String systemProperty;
public final Version from;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import java.util.function.Predicate;
import java.util.function.Supplier;

import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction.REINDEX_DATA_STREAM_FEATURE_FLAG;
import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamIndexTransportAction.REINDEX_MAX_REQUESTS_PER_SECOND_SETTING;
import static org.elasticsearch.xpack.migrate.task.ReindexDataStreamPersistentTaskExecutor.MAX_CONCURRENT_INDICES_REINDEXED_PER_DATA_STREAM_SETTING;

Expand All @@ -77,67 +76,55 @@ public List<RestHandler> getRestHandlers(
Predicate<NodeFeature> clusterSupportsFeature
) {
List<RestHandler> handlers = new ArrayList<>();
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
handlers.add(new RestMigrationReindexAction());
handlers.add(new RestGetMigrationReindexStatusAction());
handlers.add(new RestCancelReindexDataStreamAction());
handlers.add(new RestCreateIndexFromSourceAction());
}
handlers.add(new RestMigrationReindexAction());
handlers.add(new RestGetMigrationReindexStatusAction());
handlers.add(new RestCancelReindexDataStreamAction());
handlers.add(new RestCreateIndexFromSourceAction());
return handlers;
}

@Override
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> actions = new ArrayList<>();
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
actions.add(new ActionHandler<>(ReindexDataStreamAction.INSTANCE, ReindexDataStreamTransportAction.class));
actions.add(new ActionHandler<>(GetMigrationReindexStatusAction.INSTANCE, GetMigrationReindexStatusTransportAction.class));
actions.add(new ActionHandler<>(CancelReindexDataStreamAction.INSTANCE, CancelReindexDataStreamTransportAction.class));
actions.add(new ActionHandler<>(ReindexDataStreamIndexAction.INSTANCE, ReindexDataStreamIndexTransportAction.class));
actions.add(new ActionHandler<>(CreateIndexFromSourceAction.INSTANCE, CreateIndexFromSourceTransportAction.class));
}
actions.add(new ActionHandler<>(ReindexDataStreamAction.INSTANCE, ReindexDataStreamTransportAction.class));
actions.add(new ActionHandler<>(GetMigrationReindexStatusAction.INSTANCE, GetMigrationReindexStatusTransportAction.class));
actions.add(new ActionHandler<>(CancelReindexDataStreamAction.INSTANCE, CancelReindexDataStreamTransportAction.class));
actions.add(new ActionHandler<>(ReindexDataStreamIndexAction.INSTANCE, ReindexDataStreamIndexTransportAction.class));
actions.add(new ActionHandler<>(CreateIndexFromSourceAction.INSTANCE, CreateIndexFromSourceTransportAction.class));
return actions;
}

@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
return List.of(
new NamedXContentRegistry.Entry(
PersistentTaskState.class,
new ParseField(ReindexDataStreamPersistentTaskState.NAME),
ReindexDataStreamPersistentTaskState::fromXContent
),
new NamedXContentRegistry.Entry(
PersistentTaskParams.class,
new ParseField(ReindexDataStreamTaskParams.NAME),
ReindexDataStreamTaskParams::fromXContent
)
);
} else {
return List.of();
}
return List.of(
new NamedXContentRegistry.Entry(
PersistentTaskState.class,
new ParseField(ReindexDataStreamPersistentTaskState.NAME),
ReindexDataStreamPersistentTaskState::fromXContent
),
new NamedXContentRegistry.Entry(
PersistentTaskParams.class,
new ParseField(ReindexDataStreamTaskParams.NAME),
ReindexDataStreamTaskParams::fromXContent
)
);
}

@Override
public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
return List.of(
new NamedWriteableRegistry.Entry(
PersistentTaskState.class,
ReindexDataStreamPersistentTaskState.NAME,
ReindexDataStreamPersistentTaskState::new
),
new NamedWriteableRegistry.Entry(
PersistentTaskParams.class,
ReindexDataStreamTaskParams.NAME,
ReindexDataStreamTaskParams::new
),
new NamedWriteableRegistry.Entry(Task.Status.class, ReindexDataStreamStatus.NAME, ReindexDataStreamStatus::new)
);
} else {
return List.of();
}
return List.of(
new NamedWriteableRegistry.Entry(
PersistentTaskState.class,
ReindexDataStreamPersistentTaskState.NAME,
ReindexDataStreamPersistentTaskState::new
),
new NamedWriteableRegistry.Entry(
PersistentTaskParams.class,
ReindexDataStreamTaskParams.NAME,
ReindexDataStreamTaskParams::new
),
new NamedWriteableRegistry.Entry(Task.Status.class, ReindexDataStreamStatus.NAME, ReindexDataStreamStatus::new)
);
}

@Override
Expand All @@ -148,13 +135,7 @@ public List<PersistentTasksExecutor<?>> getPersistentTasksExecutor(
SettingsModule settingsModule,
IndexNameExpressionResolver expressionResolver
) {
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
return List.of(
new ReindexDataStreamPersistentTaskExecutor(client, clusterService, ReindexDataStreamTask.TASK_NAME, threadPool)
);
} else {
return List.of();
}
return List.of(new ReindexDataStreamPersistentTaskExecutor(client, clusterService, ReindexDataStreamTask.TASK_NAME, threadPool));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.util.FeatureFlag;
import org.elasticsearch.features.NodeFeature;
import org.elasticsearch.xcontent.ConstructingObjectParser;
import org.elasticsearch.xcontent.ParseField;
Expand All @@ -29,7 +28,6 @@
import java.util.function.Predicate;

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

public static final ReindexDataStreamAction INSTANCE = new ReindexDataStreamAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
import org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction;

import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.xpack.migrate.action.ReindexDataStreamAction.REINDEX_DATA_STREAM_FEATURE_FLAG;

public class RestMigrationReindexAction extends BaseRestHandler {
public static final String MIGRATION_REINDEX_CAPABILITY = "migration_reindex";
Expand Down Expand Up @@ -56,11 +53,7 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli

@Override
public Set<String> supportedCapabilities() {
Set<String> capabilities = new HashSet<>();
if (REINDEX_DATA_STREAM_FEATURE_FLAG.isEnabled()) {
capabilities.add(MIGRATION_REINDEX_CAPABILITY);
}
return Collections.unmodifiableSet(capabilities);
return Set.of(MIGRATION_REINDEX_CAPABILITY);
}

static class ReindexDataStreamRestToXContentListener extends RestBuilderListener<AcknowledgedResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setup:
---
"Test Reindex With Unsupported Mode":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand All @@ -27,7 +27,7 @@ setup:
---
"Test Reindex With Nonexistent Data Stream":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand Down Expand Up @@ -59,7 +59,7 @@ setup:
---
"Test Reindex With Bad Data Stream Name":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand All @@ -79,7 +79,7 @@ setup:
---
"Test Reindex With Existing Data Stream":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setup:
---
"Test get reindex status with nonexistent task id":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand All @@ -21,7 +21,7 @@ setup:
---
"Test Reindex With Existing Data Stream":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ teardown:
---
"Test create from with nonexistent source index":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand All @@ -33,7 +33,7 @@ teardown:
---
"Test create_from with existing source index":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand Down Expand Up @@ -69,7 +69,7 @@ teardown:
---
"Test create_from with existing source index and overrides":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand Down Expand Up @@ -122,7 +122,7 @@ teardown:
---
"Test create_from with remove_index_blocks set to false":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand Down Expand Up @@ -155,7 +155,7 @@ teardown:
---
"Test create_from with remove_index_blocks default of true":
- requires:
reason: "migration reindex is behind a feature flag"
reason: "requires a cluster with the migration reindex feature"
test_runner_features: [capabilities]
capabilities:
- method: POST
Expand Down

0 comments on commit 2462b76

Please sign in to comment.