Skip to content

Commit 08daf65

Browse files
authored
Remove health historical features and upgrade test (#116928)
1 parent 81e3afa commit 08daf65

File tree

11 files changed

+7
-121
lines changed

11 files changed

+7
-121
lines changed

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/HealthNodeUpgradeIT.java

Lines changed: 0 additions & 45 deletions
This file was deleted.

server/src/main/java/org/elasticsearch/health/HealthFeatures.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,17 @@
99

1010
package org.elasticsearch.health;
1111

12-
import org.elasticsearch.Version;
1312
import org.elasticsearch.features.FeatureSpecification;
1413
import org.elasticsearch.features.NodeFeature;
1514

16-
import java.util.Map;
1715
import java.util.Set;
1816

1917
public class HealthFeatures implements FeatureSpecification {
2018

21-
public static final NodeFeature SUPPORTS_HEALTH = new NodeFeature("health.supports_health");
22-
public static final NodeFeature SUPPORTS_HEALTH_REPORT_API = new NodeFeature("health.supports_health_report_api");
23-
public static final NodeFeature SUPPORTS_SHARDS_CAPACITY_INDICATOR = new NodeFeature("health.shards_capacity_indicator");
2419
public static final NodeFeature SUPPORTS_EXTENDED_REPOSITORY_INDICATOR = new NodeFeature("health.extended_repository_indicator");
2520

2621
@Override
2722
public Set<NodeFeature> getFeatures() {
2823
return Set.of(SUPPORTS_EXTENDED_REPOSITORY_INDICATOR);
2924
}
30-
31-
@Override
32-
public Map<NodeFeature, Version> getHistoricalFeatures() {
33-
return Map.of(
34-
SUPPORTS_HEALTH,
35-
Version.V_8_5_0, // health accessible via /_internal/_health
36-
SUPPORTS_HEALTH_REPORT_API,
37-
Version.V_8_7_0, // health accessible via /_health_report
38-
SUPPORTS_SHARDS_CAPACITY_INDICATOR,
39-
Version.V_8_8_0
40-
);
41-
}
4225
}

server/src/main/java/org/elasticsearch/health/metadata/HealthMetadataService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.elasticsearch.core.Tuple;
2929
import org.elasticsearch.features.FeatureService;
3030
import org.elasticsearch.gateway.GatewayService;
31-
import org.elasticsearch.health.HealthFeatures;
3231

3332
import java.util.List;
3433
import java.util.stream.Stream;
@@ -137,7 +136,7 @@ private void updateOnHealthNodeEnabledChange(boolean enabled) {
137136

138137
private boolean canPostClusterStateUpdates(ClusterState state) {
139138
// Wait until every node in the cluster supports health checks
140-
return isMaster && state.clusterRecovered() && featureService.clusterHasFeature(state, HealthFeatures.SUPPORTS_HEALTH);
139+
return isMaster && state.clusterRecovered();
141140
}
142141

143142
private void updateOnClusterStateChange(ClusterChangedEvent event) {

server/src/main/java/org/elasticsearch/health/node/DiskHealthIndicatorService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.elasticsearch.common.util.set.Sets;
2121
import org.elasticsearch.features.FeatureService;
2222
import org.elasticsearch.health.Diagnosis;
23-
import org.elasticsearch.health.HealthFeatures;
2423
import org.elasticsearch.health.HealthIndicatorDetails;
2524
import org.elasticsearch.health.HealthIndicatorImpact;
2625
import org.elasticsearch.health.HealthIndicatorResult;
@@ -91,15 +90,6 @@ public HealthIndicatorResult calculate(boolean verbose, int maxAffectedResources
9190
ClusterState clusterState = clusterService.state();
9291
Map<String, DiskHealthInfo> diskHealthInfoMap = healthInfo.diskInfoByNode();
9392
if (diskHealthInfoMap == null || diskHealthInfoMap.isEmpty()) {
94-
if (featureService.clusterHasFeature(clusterState, HealthFeatures.SUPPORTS_HEALTH) == false) {
95-
return createIndicator(
96-
HealthStatus.GREEN,
97-
"No disk usage data available. The cluster currently has mixed versions (an upgrade may be in progress).",
98-
HealthIndicatorDetails.EMPTY,
99-
List.of(),
100-
List.of()
101-
);
102-
}
10393
/*
10494
* If there is no disk health info, that either means that a new health node was just elected, or something is seriously
10595
* wrong with health data collection on the health node. Either way, we immediately return UNKNOWN. If there are at least

server/src/main/java/org/elasticsearch/health/node/LocalHealthMonitor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.elasticsearch.common.util.concurrent.RunOnce;
2626
import org.elasticsearch.core.TimeValue;
2727
import org.elasticsearch.features.FeatureService;
28-
import org.elasticsearch.health.HealthFeatures;
2928
import org.elasticsearch.health.metadata.HealthMetadata;
3029
import org.elasticsearch.health.node.action.HealthNodeNotDiscoveredException;
3130
import org.elasticsearch.health.node.selection.HealthNode;
@@ -200,7 +199,6 @@ public void clusterChanged(ClusterChangedEvent event) {
200199
}
201200
}
202201
prerequisitesFulfilled = event.state().clusterRecovered()
203-
&& featureService.clusterHasFeature(event.state(), HealthFeatures.SUPPORTS_HEALTH)
204202
&& HealthMetadata.getFromClusterState(event.state()) != null
205203
&& currentHealthNode != null
206204
&& currentMasterNode != null;

server/src/main/java/org/elasticsearch/health/node/ShardsCapacityHealthIndicatorService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import org.elasticsearch.common.settings.Setting;
1717
import org.elasticsearch.features.FeatureService;
1818
import org.elasticsearch.health.Diagnosis;
19-
import org.elasticsearch.health.HealthFeatures;
2019
import org.elasticsearch.health.HealthIndicatorDetails;
2120
import org.elasticsearch.health.HealthIndicatorImpact;
2221
import org.elasticsearch.health.HealthIndicatorResult;
@@ -111,15 +110,6 @@ public HealthIndicatorResult calculate(boolean verbose, int maxAffectedResources
111110
var state = clusterService.state();
112111
var healthMetadata = HealthMetadata.getFromClusterState(state);
113112
if (healthMetadata == null || healthMetadata.getShardLimitsMetadata() == null) {
114-
if (featureService.clusterHasFeature(state, HealthFeatures.SUPPORTS_SHARDS_CAPACITY_INDICATOR) == false) {
115-
return createIndicator(
116-
HealthStatus.GREEN,
117-
"No shard limits configured yet. The cluster currently has mixed versions (an upgrade may be in progress).",
118-
HealthIndicatorDetails.EMPTY,
119-
List.of(),
120-
List.of()
121-
);
122-
}
123113
return unknownIndicator();
124114
}
125115

server/src/main/java/org/elasticsearch/health/node/selection/HealthNodeTaskExecutor.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.elasticsearch.common.settings.Setting;
2424
import org.elasticsearch.common.settings.Settings;
2525
import org.elasticsearch.features.FeatureService;
26-
import org.elasticsearch.health.HealthFeatures;
2726
import org.elasticsearch.node.NodeClosedException;
2827
import org.elasticsearch.persistent.AllocatedPersistentTask;
2928
import org.elasticsearch.persistent.PersistentTaskParams;
@@ -157,11 +156,8 @@ public PersistentTasksCustomMetadata.Assignment getAssignment(
157156

158157
// visible for testing
159158
void startTask(ClusterChangedEvent event) {
160-
// Wait until every node in the cluster supports health checks
161-
if (event.localNodeMaster()
162-
&& event.state().clusterRecovered()
163-
&& HealthNode.findTask(event.state()) == null
164-
&& featureService.clusterHasFeature(event.state(), HealthFeatures.SUPPORTS_HEALTH)) {
159+
// Wait until master is stable before starting health task
160+
if (event.localNodeMaster() && event.state().clusterRecovered() && HealthNode.findTask(event.state()) == null) {
165161
persistentTasksService.sendStartRequest(
166162
TASK_NAME,
167163
TASK_NAME,

server/src/test/java/org/elasticsearch/health/node/DiskHealthIndicatorServiceTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
3030
import org.elasticsearch.features.FeatureService;
3131
import org.elasticsearch.health.Diagnosis;
32-
import org.elasticsearch.health.HealthFeatures;
3332
import org.elasticsearch.health.HealthIndicatorDetails;
3433
import org.elasticsearch.health.HealthIndicatorImpact;
3534
import org.elasticsearch.health.HealthIndicatorResult;
@@ -1085,12 +1084,8 @@ static ClusterState createClusterState(
10851084
Collection<DiscoveryNode> nodes,
10861085
Map<String, Set<String>> indexNameToNodeIdsMap
10871086
) {
1088-
Map<String, Set<String>> features = new HashMap<>();
10891087
DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder();
1090-
for (DiscoveryNode node : nodes) {
1091-
nodesBuilder = nodesBuilder.add(node);
1092-
features.put(node.getId(), Set.of(HealthFeatures.SUPPORTS_HEALTH.id()));
1093-
}
1088+
nodes.forEach(nodesBuilder::add);
10941089
nodesBuilder.localNodeId(randomFrom(nodes).getId());
10951090
nodesBuilder.masterNodeId(randomFrom(nodes).getId());
10961091
ClusterBlocks.Builder clusterBlocksBuilder = new ClusterBlocks.Builder();
@@ -1125,7 +1120,6 @@ static ClusterState createClusterState(
11251120
state.metadata(metadata.generateClusterUuidIfNeeded().build());
11261121
state.routingTable(routingTable.build());
11271122
state.blocks(clusterBlocksBuilder);
1128-
state.nodeFeatures(features);
11291123
return state.build();
11301124
}
11311125

server/src/test/java/org/elasticsearch/health/node/ShardsCapacityHealthIndicatorServiceTests.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.elasticsearch.common.settings.Settings;
2222
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
2323
import org.elasticsearch.features.FeatureService;
24-
import org.elasticsearch.health.HealthFeatures;
2524
import org.elasticsearch.health.HealthIndicatorDetails;
2625
import org.elasticsearch.health.HealthStatus;
2726
import org.elasticsearch.health.metadata.HealthMetadata;
@@ -451,11 +450,7 @@ private ClusterState createClusterState(
451450
metadata.put(idxMetadata);
452451
}
453452

454-
var features = Set.of(HealthFeatures.SUPPORTS_SHARDS_CAPACITY_INDICATOR.id());
455-
return ClusterState.builder(clusterState)
456-
.metadata(metadata)
457-
.nodeFeatures(Map.of(dataNode.getId(), features, frozenNode.getId(), features))
458-
.build();
453+
return ClusterState.builder(clusterState).metadata(metadata).build();
459454
}
460455

461456
private static IndexMetadata.Builder createIndexInDataNode(int shards) {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/HealthApiUsageTransportAction.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import org.elasticsearch.cluster.ClusterState;
1414
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
1515
import org.elasticsearch.cluster.service.ClusterService;
16-
import org.elasticsearch.features.FeatureService;
17-
import org.elasticsearch.features.NodeFeature;
1816
import org.elasticsearch.health.stats.HealthApiStatsAction;
1917
import org.elasticsearch.injection.guice.Inject;
2018
import org.elasticsearch.protocol.xpack.XPackUsageRequest;
@@ -30,10 +28,7 @@
3028
*/
3129
public class HealthApiUsageTransportAction extends XPackUsageFeatureTransportAction {
3230

33-
static final NodeFeature SUPPORTS_HEALTH_STATS = new NodeFeature("health.supports_health_stats");
34-
3531
private final Client client;
36-
private final FeatureService featureService;
3732

3833
@Inject
3934
public HealthApiUsageTransportAction(
@@ -42,8 +37,7 @@ public HealthApiUsageTransportAction(
4237
ThreadPool threadPool,
4338
ActionFilters actionFilters,
4439
IndexNameExpressionResolver indexNameExpressionResolver,
45-
Client client,
46-
FeatureService featureService
40+
Client client
4741
) {
4842
super(
4943
XPackUsageFeatureAction.HEALTH.name(),
@@ -54,7 +48,6 @@ public HealthApiUsageTransportAction(
5448
indexNameExpressionResolver
5549
);
5650
this.client = client;
57-
this.featureService = featureService;
5851
}
5952

6053
@Override
@@ -70,7 +63,7 @@ protected void masterOperation(
7063
client.threadPool().getThreadContext()
7164
);
7265

73-
if (state.clusterRecovered() && featureService.clusterHasFeature(state, SUPPORTS_HEALTH_STATS)) {
66+
if (state.clusterRecovered()) {
7467
HealthApiStatsAction.Request statsRequest = new HealthApiStatsAction.Request();
7568
statsRequest.setParentTask(clusterService.localNode().getId(), task.getId());
7669
client.execute(HealthApiStatsAction.INSTANCE, statsRequest, preservingListener.delegateFailureAndWrap((l, r) -> {

0 commit comments

Comments
 (0)