mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -04:00
Remove health historical features and upgrade test (#116928)
This commit is contained in:
parent
81e3afaafa
commit
08daf65592
11 changed files with 7 additions and 121 deletions
|
@ -1,45 +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.apache.http.util.EntityUtils;
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.client.Response;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
|
||||
public class HealthNodeUpgradeIT extends AbstractRollingUpgradeTestCase {
|
||||
|
||||
public HealthNodeUpgradeIT(@Name("upgradedNodes") int upgradedNodes) {
|
||||
super(upgradedNodes);
|
||||
}
|
||||
|
||||
public void testHealthNode() throws Exception {
|
||||
if (clusterHasFeature("health.supports_health")) {
|
||||
assertBusy(() -> {
|
||||
Response response = client().performRequest(new Request("GET", "_cat/tasks"));
|
||||
String tasks = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
|
||||
assertThat(tasks, Matchers.containsString("health-node"));
|
||||
});
|
||||
assertBusy(() -> {
|
||||
String path = clusterHasFeature("health.supports_health_report_api") ? "_health_report" : "_internal/_health";
|
||||
Response response = client().performRequest(new Request("GET", path));
|
||||
Map<String, Object> health_report = entityAsMap(response.getEntity());
|
||||
assertThat(health_report.get("status"), equalTo("green"));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,34 +9,17 @@
|
|||
|
||||
package org.elasticsearch.health;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.features.FeatureSpecification;
|
||||
import org.elasticsearch.features.NodeFeature;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class HealthFeatures implements FeatureSpecification {
|
||||
|
||||
public static final NodeFeature SUPPORTS_HEALTH = new NodeFeature("health.supports_health");
|
||||
public static final NodeFeature SUPPORTS_HEALTH_REPORT_API = new NodeFeature("health.supports_health_report_api");
|
||||
public static final NodeFeature SUPPORTS_SHARDS_CAPACITY_INDICATOR = new NodeFeature("health.shards_capacity_indicator");
|
||||
public static final NodeFeature SUPPORTS_EXTENDED_REPOSITORY_INDICATOR = new NodeFeature("health.extended_repository_indicator");
|
||||
|
||||
@Override
|
||||
public Set<NodeFeature> getFeatures() {
|
||||
return Set.of(SUPPORTS_EXTENDED_REPOSITORY_INDICATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<NodeFeature, Version> getHistoricalFeatures() {
|
||||
return Map.of(
|
||||
SUPPORTS_HEALTH,
|
||||
Version.V_8_5_0, // health accessible via /_internal/_health
|
||||
SUPPORTS_HEALTH_REPORT_API,
|
||||
Version.V_8_7_0, // health accessible via /_health_report
|
||||
SUPPORTS_SHARDS_CAPACITY_INDICATOR,
|
||||
Version.V_8_8_0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.core.Nullable;
|
|||
import org.elasticsearch.core.Tuple;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.elasticsearch.gateway.GatewayService;
|
||||
import org.elasticsearch.health.HealthFeatures;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -137,7 +136,7 @@ public class HealthMetadataService {
|
|||
|
||||
private boolean canPostClusterStateUpdates(ClusterState state) {
|
||||
// Wait until every node in the cluster supports health checks
|
||||
return isMaster && state.clusterRecovered() && featureService.clusterHasFeature(state, HealthFeatures.SUPPORTS_HEALTH);
|
||||
return isMaster && state.clusterRecovered();
|
||||
}
|
||||
|
||||
private void updateOnClusterStateChange(ClusterChangedEvent event) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.elasticsearch.cluster.service.ClusterService;
|
|||
import org.elasticsearch.common.util.set.Sets;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.elasticsearch.health.Diagnosis;
|
||||
import org.elasticsearch.health.HealthFeatures;
|
||||
import org.elasticsearch.health.HealthIndicatorDetails;
|
||||
import org.elasticsearch.health.HealthIndicatorImpact;
|
||||
import org.elasticsearch.health.HealthIndicatorResult;
|
||||
|
@ -91,15 +90,6 @@ public class DiskHealthIndicatorService implements HealthIndicatorService {
|
|||
ClusterState clusterState = clusterService.state();
|
||||
Map<String, DiskHealthInfo> diskHealthInfoMap = healthInfo.diskInfoByNode();
|
||||
if (diskHealthInfoMap == null || diskHealthInfoMap.isEmpty()) {
|
||||
if (featureService.clusterHasFeature(clusterState, HealthFeatures.SUPPORTS_HEALTH) == false) {
|
||||
return createIndicator(
|
||||
HealthStatus.GREEN,
|
||||
"No disk usage data available. The cluster currently has mixed versions (an upgrade may be in progress).",
|
||||
HealthIndicatorDetails.EMPTY,
|
||||
List.of(),
|
||||
List.of()
|
||||
);
|
||||
}
|
||||
/*
|
||||
* If there is no disk health info, that either means that a new health node was just elected, or something is seriously
|
||||
* wrong with health data collection on the health node. Either way, we immediately return UNKNOWN. If there are at least
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
|||
import org.elasticsearch.common.util.concurrent.RunOnce;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.elasticsearch.health.HealthFeatures;
|
||||
import org.elasticsearch.health.metadata.HealthMetadata;
|
||||
import org.elasticsearch.health.node.action.HealthNodeNotDiscoveredException;
|
||||
import org.elasticsearch.health.node.selection.HealthNode;
|
||||
|
@ -200,7 +199,6 @@ public class LocalHealthMonitor implements ClusterStateListener {
|
|||
}
|
||||
}
|
||||
prerequisitesFulfilled = event.state().clusterRecovered()
|
||||
&& featureService.clusterHasFeature(event.state(), HealthFeatures.SUPPORTS_HEALTH)
|
||||
&& HealthMetadata.getFromClusterState(event.state()) != null
|
||||
&& currentHealthNode != null
|
||||
&& currentMasterNode != null;
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.common.TriFunction;
|
|||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.elasticsearch.health.Diagnosis;
|
||||
import org.elasticsearch.health.HealthFeatures;
|
||||
import org.elasticsearch.health.HealthIndicatorDetails;
|
||||
import org.elasticsearch.health.HealthIndicatorImpact;
|
||||
import org.elasticsearch.health.HealthIndicatorResult;
|
||||
|
@ -111,15 +110,6 @@ public class ShardsCapacityHealthIndicatorService implements HealthIndicatorServ
|
|||
var state = clusterService.state();
|
||||
var healthMetadata = HealthMetadata.getFromClusterState(state);
|
||||
if (healthMetadata == null || healthMetadata.getShardLimitsMetadata() == null) {
|
||||
if (featureService.clusterHasFeature(state, HealthFeatures.SUPPORTS_SHARDS_CAPACITY_INDICATOR) == false) {
|
||||
return createIndicator(
|
||||
HealthStatus.GREEN,
|
||||
"No shard limits configured yet. The cluster currently has mixed versions (an upgrade may be in progress).",
|
||||
HealthIndicatorDetails.EMPTY,
|
||||
List.of(),
|
||||
List.of()
|
||||
);
|
||||
}
|
||||
return unknownIndicator();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.settings.ClusterSettings;
|
|||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.elasticsearch.health.HealthFeatures;
|
||||
import org.elasticsearch.node.NodeClosedException;
|
||||
import org.elasticsearch.persistent.AllocatedPersistentTask;
|
||||
import org.elasticsearch.persistent.PersistentTaskParams;
|
||||
|
@ -157,11 +156,8 @@ public final class HealthNodeTaskExecutor extends PersistentTasksExecutor<Health
|
|||
|
||||
// visible for testing
|
||||
void startTask(ClusterChangedEvent event) {
|
||||
// Wait until every node in the cluster supports health checks
|
||||
if (event.localNodeMaster()
|
||||
&& event.state().clusterRecovered()
|
||||
&& HealthNode.findTask(event.state()) == null
|
||||
&& featureService.clusterHasFeature(event.state(), HealthFeatures.SUPPORTS_HEALTH)) {
|
||||
// Wait until master is stable before starting health task
|
||||
if (event.localNodeMaster() && event.state().clusterRecovered() && HealthNode.findTask(event.state()) == null) {
|
||||
persistentTasksService.sendStartRequest(
|
||||
TASK_NAME,
|
||||
TASK_NAME,
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.common.util.set.Sets;
|
|||
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.elasticsearch.health.Diagnosis;
|
||||
import org.elasticsearch.health.HealthFeatures;
|
||||
import org.elasticsearch.health.HealthIndicatorDetails;
|
||||
import org.elasticsearch.health.HealthIndicatorImpact;
|
||||
import org.elasticsearch.health.HealthIndicatorResult;
|
||||
|
@ -1085,12 +1084,8 @@ public class DiskHealthIndicatorServiceTests extends ESTestCase {
|
|||
Collection<DiscoveryNode> nodes,
|
||||
Map<String, Set<String>> indexNameToNodeIdsMap
|
||||
) {
|
||||
Map<String, Set<String>> features = new HashMap<>();
|
||||
DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder();
|
||||
for (DiscoveryNode node : nodes) {
|
||||
nodesBuilder = nodesBuilder.add(node);
|
||||
features.put(node.getId(), Set.of(HealthFeatures.SUPPORTS_HEALTH.id()));
|
||||
}
|
||||
nodes.forEach(nodesBuilder::add);
|
||||
nodesBuilder.localNodeId(randomFrom(nodes).getId());
|
||||
nodesBuilder.masterNodeId(randomFrom(nodes).getId());
|
||||
ClusterBlocks.Builder clusterBlocksBuilder = new ClusterBlocks.Builder();
|
||||
|
@ -1125,7 +1120,6 @@ public class DiskHealthIndicatorServiceTests extends ESTestCase {
|
|||
state.metadata(metadata.generateClusterUuidIfNeeded().build());
|
||||
state.routingTable(routingTable.build());
|
||||
state.blocks(clusterBlocksBuilder);
|
||||
state.nodeFeatures(features);
|
||||
return state.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.elasticsearch.common.bytes.BytesReference;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.elasticsearch.health.HealthFeatures;
|
||||
import org.elasticsearch.health.HealthIndicatorDetails;
|
||||
import org.elasticsearch.health.HealthStatus;
|
||||
import org.elasticsearch.health.metadata.HealthMetadata;
|
||||
|
@ -451,11 +450,7 @@ public class ShardsCapacityHealthIndicatorServiceTests extends ESTestCase {
|
|||
metadata.put(idxMetadata);
|
||||
}
|
||||
|
||||
var features = Set.of(HealthFeatures.SUPPORTS_SHARDS_CAPACITY_INDICATOR.id());
|
||||
return ClusterState.builder(clusterState)
|
||||
.metadata(metadata)
|
||||
.nodeFeatures(Map.of(dataNode.getId(), features, frozenNode.getId(), features))
|
||||
.build();
|
||||
return ClusterState.builder(clusterState).metadata(metadata).build();
|
||||
}
|
||||
|
||||
private static IndexMetadata.Builder createIndexInDataNode(int shards) {
|
||||
|
|
|
@ -13,8 +13,6 @@ import org.elasticsearch.client.internal.Client;
|
|||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.features.FeatureService;
|
||||
import org.elasticsearch.features.NodeFeature;
|
||||
import org.elasticsearch.health.stats.HealthApiStatsAction;
|
||||
import org.elasticsearch.injection.guice.Inject;
|
||||
import org.elasticsearch.protocol.xpack.XPackUsageRequest;
|
||||
|
@ -30,10 +28,7 @@ import org.elasticsearch.xpack.core.action.XPackUsageFeatureTransportAction;
|
|||
*/
|
||||
public class HealthApiUsageTransportAction extends XPackUsageFeatureTransportAction {
|
||||
|
||||
static final NodeFeature SUPPORTS_HEALTH_STATS = new NodeFeature("health.supports_health_stats");
|
||||
|
||||
private final Client client;
|
||||
private final FeatureService featureService;
|
||||
|
||||
@Inject
|
||||
public HealthApiUsageTransportAction(
|
||||
|
@ -42,8 +37,7 @@ public class HealthApiUsageTransportAction extends XPackUsageFeatureTransportAct
|
|||
ThreadPool threadPool,
|
||||
ActionFilters actionFilters,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
Client client,
|
||||
FeatureService featureService
|
||||
Client client
|
||||
) {
|
||||
super(
|
||||
XPackUsageFeatureAction.HEALTH.name(),
|
||||
|
@ -54,7 +48,6 @@ public class HealthApiUsageTransportAction extends XPackUsageFeatureTransportAct
|
|||
indexNameExpressionResolver
|
||||
);
|
||||
this.client = client;
|
||||
this.featureService = featureService;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +63,7 @@ public class HealthApiUsageTransportAction extends XPackUsageFeatureTransportAct
|
|||
client.threadPool().getThreadContext()
|
||||
);
|
||||
|
||||
if (state.clusterRecovered() && featureService.clusterHasFeature(state, SUPPORTS_HEALTH_STATS)) {
|
||||
if (state.clusterRecovered()) {
|
||||
HealthApiStatsAction.Request statsRequest = new HealthApiStatsAction.Request();
|
||||
statsRequest.setParentTask(clusterService.localNode().getId(), task.getId());
|
||||
client.execute(HealthApiStatsAction.INSTANCE, statsRequest, preservingListener.delegateFailureAndWrap((l, r) -> {
|
||||
|
|
|
@ -7,13 +7,11 @@
|
|||
|
||||
package org.elasticsearch.xpack.core;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.features.FeatureSpecification;
|
||||
import org.elasticsearch.features.NodeFeature;
|
||||
import org.elasticsearch.license.License;
|
||||
import org.elasticsearch.xpack.core.datatiers.NodesDataTiersUsageTransportAction;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -32,9 +30,4 @@ public class XPackFeatures implements FeatureSpecification {
|
|||
LOGSDB_TELMETRY_STATS
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<NodeFeature, Version> getHistoricalFeatures() {
|
||||
return Map.of(HealthApiUsageTransportAction.SUPPORTS_HEALTH_STATS, Version.V_8_7_0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue