Skip to content

Commit

Permalink
Add a NodeFeature and require it in the YAML test
Browse files Browse the repository at this point in the history
  • Loading branch information
PeteGillinElastic committed Dec 17, 2024
1 parent b3ca98c commit 2bddabe
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
setup:
- requires:
reason: "Data stream options was added in 8.18+"
reason: "Data stream options and cluster setting for feature store were added in 8.18+"
test_runner_features: [ capabilities, allowed_warnings, contains ]
capabilities:
- method: POST
Expand All @@ -9,6 +9,7 @@ setup:
- method: POST
path: /_index_template/{template}
capabilities: [ 'failure_store_in_template' ]
cluster_features: [ 'data_streams.failure_store.cluster_setting' ]

- do:
cluster.put_settings:
Expand Down
3 changes: 2 additions & 1 deletion server/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
org.elasticsearch.script.ScriptFeatures,
org.elasticsearch.search.retriever.RetrieversFeatures,
org.elasticsearch.reservedstate.service.FileSettingsFeatures,
org.elasticsearch.action.admin.cluster.stats.ClusterStatsFeatures;
org.elasticsearch.action.admin.cluster.stats.ClusterStatsFeatures,
org.elasticsearch.cluster.metadata.DataStreamFailureStoreSettingsFeatureSpecification;

uses org.elasticsearch.plugins.internal.SettingsExtension;
uses RestExtension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.core.UpdateForV10;
import org.elasticsearch.features.NodeFeature;

import java.util.List;
import java.util.function.Predicate;
Expand All @@ -25,6 +27,9 @@
*/
public class DataStreamFailureStoreSettings {

@UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT) // Remove this when we no longer need BWC with versions without this feature
static final NodeFeature NODE_FEATURE = new NodeFeature("data_streams.failure_store.cluster_setting");

private static final Logger logger = LogManager.getLogger(DataStreamFailureStoreSettings.class);

public static final Setting<List<String>> DATA_STREAM_FAILURE_STORED_ENABLED_SETTING = Setting.stringListSetting(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.cluster.metadata;

import org.elasticsearch.features.FeatureSpecification;
import org.elasticsearch.features.NodeFeature;

import java.util.Set;

/**
* Registers the ability to specify data stream failure store cluster settings as a node feature.
*/
public class DataStreamFailureStoreSettingsFeatureSpecification implements FeatureSpecification {

public Set<NodeFeature> getFeatures() {
return DataStream.isFailureStoreFeatureFlagEnabled() ? Set.of(DataStreamFailureStoreSettings.NODE_FEATURE) : Set.of();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ org.elasticsearch.script.ScriptFeatures
org.elasticsearch.reservedstate.service.FileSettingsFeatures
org.elasticsearch.cluster.routing.RoutingFeatures
org.elasticsearch.action.admin.cluster.stats.ClusterStatsFeatures
org.elasticsearch.cluster.metadata.DataStreamFailureStoreSettingsFeatureSpecification

0 comments on commit 2bddabe

Please sign in to comment.