Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -13,6 +13,7 @@
import org.elasticsearch.features.NodeFeature;
import org.elasticsearch.reindex.ReindexPlugin;

import java.util.HashSet;
import java.util.Set;

public class ReindexManagementFeatures implements FeatureSpecification {
Expand All @@ -21,9 +22,17 @@ public class ReindexManagementFeatures implements FeatureSpecification {

@Override
public Set<NodeFeature> getFeatures() {
// TODO: Before we release this functionality by removing the REINDEX_RESILIENCE_ENABLED checks, we should see whether we can
final Set<NodeFeature> features = new HashSet<>();
// TODO: Before we release any functionality behind FeatureFlags, we should see whether we can
// consolidate the node features. These are a constrained resource, so we should combine the features for anything that is being
// released at the same time while we still can.
return ReindexPlugin.REINDEX_RESILIENCE_ENABLED ? Set.of(NEW_ENDPOINTS, ReindexPlugin.RELOCATE_ON_SHUTDOWN_NODE_FEATURE) : Set.of();
if (ReindexPlugin.REINDEX_RESILIENCE_ENABLED) {
features.add(NEW_ENDPOINTS);
features.add(ReindexPlugin.RELOCATE_ON_SHUTDOWN_NODE_FEATURE);
}
if (ReindexPlugin.REINDEX_PIT_SEARCH_ENABLED) {
features.add(ReindexPlugin.REINDEX_PIT_SEARCH_FEATURE);
}
return Set.copyOf(features);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,23 @@ public class ReindexPlugin extends Plugin implements ActionPlugin, ExtensiblePlu

public static final ActionType<ListTasksResponse> RETHROTTLE_ACTION = new ActionType<>("cluster:admin/reindex/rethrottle");

// N.B. We declare this in the reindex module, so that we can check whether the feature is available on the cluster here - but we
// register it via a FeatureSpecification in the reindex-management module, to work around build problems caused by doing it here.
// N.B. We declare these in the reindex module, so that we can check whether the features are available on the cluster here - but we
// register them via a FeatureSpecification in the reindex-management module, to work around build problems caused by doing it here.
// (The enrich plugin depends on this module, and registering features leads to either duplicate feature or JAR hell errors.)
// (This approach means that the functionality requires both reindex and reindex-management modules to be present and enabled.)
public static final NodeFeature RELOCATE_ON_SHUTDOWN_NODE_FEATURE = new NodeFeature("reindex_relocate_on_shutdown");
public static final NodeFeature REINDEX_PIT_SEARCH_FEATURE = new NodeFeature("reindex_pit_search");

/**
* Whether the feature flag to guard the work to make reindex more resilient while it is under development.
*/
public static final boolean REINDEX_RESILIENCE_ENABLED = new FeatureFlag("reindex_resilience").isEnabled();

/**
* Guards the development work to change reindexing to use point in time (PIT) searching
*/
public static final boolean REINDEX_PIT_SEARCH_ENABLED = new FeatureFlag("reindex_pit_search").isEnabled();

@Override
public List<ActionHandler> getActions() {
return Arrays.asList(
Expand Down