mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -04:00
Remove the features supported feature (#119758)
This removes the features_supported feature from the codebase, as all nodes communicable with 9.0 will support features
This commit is contained in:
parent
f383c86851
commit
c41897e9c4
5 changed files with 2 additions and 77 deletions
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* 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.upgrades;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
|
||||
public class ClusterFeatureMigrationIT extends AbstractRollingUpgradeTestCase {
|
||||
|
||||
@Before
|
||||
public void checkMigrationVersion() {
|
||||
assumeFalse(
|
||||
"This checks migrations from before cluster features were introduced",
|
||||
oldClusterHasFeature(FeatureService.FEATURES_SUPPORTED)
|
||||
);
|
||||
}
|
||||
|
||||
public ClusterFeatureMigrationIT(@Name("upgradedNodes") int upgradedNodes) {
|
||||
super(upgradedNodes);
|
||||
}
|
||||
|
||||
public void testClusterFeatureMigration() throws IOException {
|
||||
if (isUpgradedCluster()) {
|
||||
// check the nodes all have a feature in their cluster state (there should always be features_supported)
|
||||
var response = entityAsMap(adminClient().performRequest(new Request("GET", "/_cluster/state/nodes")));
|
||||
List<?> nodeFeatures = (List<?>) XContentMapValues.extractValue("nodes_features", response);
|
||||
assertThat(nodeFeatures, hasSize(adminClient().getNodes().size()));
|
||||
|
||||
Map<String, List<?>> features = nodeFeatures.stream()
|
||||
.map(o -> (Map<?, ?>) o)
|
||||
.collect(Collectors.toMap(m -> (String) m.get("node_id"), m -> (List<?>) m.get("features")));
|
||||
|
||||
Set<String> missing = features.entrySet()
|
||||
.stream()
|
||||
.filter(e -> e.getValue().contains(FeatureService.FEATURES_SUPPORTED.id()) == false)
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(Collectors.toSet());
|
||||
assertThat(missing + " out of " + features.keySet() + " does not have the required feature", missing, empty());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,7 +30,6 @@ public class ClusterFeaturesIT extends ESIntegTestCase {
|
|||
|
||||
FeatureService service = internalCluster().getCurrentMasterNodeInstance(FeatureService.class);
|
||||
|
||||
assertThat(service.getNodeFeatures(), hasKey(FeatureService.FEATURES_SUPPORTED.id()));
|
||||
assertThat(service.getNodeFeatures(), hasKey(FeatureService.TEST_FEATURES_ENABLED.id()));
|
||||
|
||||
// check the nodes all have a feature in their cluster state (there should always be features_supported)
|
||||
|
@ -38,7 +37,7 @@ public class ClusterFeaturesIT extends ESIntegTestCase {
|
|||
var features = response.getState().clusterFeatures().nodeFeatures();
|
||||
Set<String> missing = features.entrySet()
|
||||
.stream()
|
||||
.filter(e -> e.getValue().contains(FeatureService.FEATURES_SUPPORTED.id()) == false)
|
||||
.filter(e -> e.getValue().contains(FeatureService.TEST_FEATURES_ENABLED.id()) == false)
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(Collectors.toSet());
|
||||
assertThat(missing + " out of " + features.keySet() + " does not have the required feature", missing, empty());
|
||||
|
|
|
@ -13,18 +13,9 @@ import java.util.Set;
|
|||
|
||||
/**
|
||||
* This class specifies features for the features functionality itself.
|
||||
* <p>
|
||||
* This adds a feature {@code features_supported} indicating that a node supports node features.
|
||||
* Nodes that do not support features won't have this feature in its feature set,
|
||||
* so this can be checked without needing to look at the node version.
|
||||
*/
|
||||
public class FeatureInfrastructureFeatures implements FeatureSpecification {
|
||||
|
||||
@Override
|
||||
public Set<NodeFeature> getFeatures() {
|
||||
return Set.of(FeatureService.FEATURES_SUPPORTED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<NodeFeature> getTestFeatures() {
|
||||
return Set.of(FeatureService.TEST_FEATURES_ENABLED);
|
||||
|
|
|
@ -26,10 +26,6 @@ import java.util.Map;
|
|||
*/
|
||||
public class FeatureService {
|
||||
|
||||
/**
|
||||
* A feature indicating that node features are supported.
|
||||
*/
|
||||
public static final NodeFeature FEATURES_SUPPORTED = new NodeFeature("features_supported", true);
|
||||
public static final NodeFeature TEST_FEATURES_ENABLED = new NodeFeature("test_features_enabled");
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(FeatureService.class);
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Set;
|
|||
*/
|
||||
public interface FeatureSpecification {
|
||||
/**
|
||||
* Returns a set of regular features that this node supports.
|
||||
* Returns a set of features that this node supports.
|
||||
*/
|
||||
default Set<NodeFeature> getFeatures() {
|
||||
return Set.of();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue