Module org.elasticsearch.server
Class ShardsAvailabilityHealthIndicatorService
java.lang.Object
org.elasticsearch.cluster.routing.allocation.shards.ShardsAvailabilityHealthIndicatorService
- All Implemented Interfaces:
HealthIndicatorService
- Direct Known Subclasses:
StatefulShardsAvailabilityHealthIndicatorService
public abstract class ShardsAvailabilityHealthIndicatorService
extends Object
implements HealthIndicatorService
This is the parent class for shard health indicators. The reported status will depend on whether we are running in stateless or stateful
mode.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classclassclass -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Diagnosis.Definitionstatic final Diagnosis.Definitionstatic final Diagnosis.Definitionstatic final Diagnosis.Definitionstatic final Diagnosis.Definitionstatic final Diagnosis.Definitionstatic final Diagnosis.Definitionprotected final ClusterServicestatic final Stringstatic final Diagnosis.Definitionstatic final Diagnosis.Definitionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected final ProjectResolverstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.elasticsearch.health.HealthIndicatorService
MAX_AFFECTED_RESOURCES_COUNT -
Constructor Summary
ConstructorsConstructorDescriptionShardsAvailabilityHealthIndicatorService(ClusterService clusterService, AllocationService allocationService, SystemIndices systemIndices, ProjectResolver projectResolver) -
Method Summary
Modifier and TypeMethodDescriptioncalculate(boolean verbose, int maxAffectedResourcesCount, HealthInfo healthInfo) protected abstract List<Diagnosis.Definition> checkNodeRoleRelatedIssues(IndexMetadata indexMetadata, List<NodeAllocationResult> nodeAllocationResults, ClusterState clusterState, ShardRouting shardRouting) Generates a list of diagnoses for common problems that keep a shard from allocating to nodes depending on their role; a very common example of such a case are data tiers.protected List<Diagnosis.Definition> checkNodesWithRoleAtShardLimit(IndexMetadata indexMetadata, ClusterState clusterState, List<NodeAllocationResult> nodeRoleAllocationResults, Set<DiscoveryNode> nodesWithRoles, String role) protected Optional<Diagnosis.Definition> checkNotEnoughNodesWithRole(List<NodeAllocationResult> nodeAllocationResults, String role) createNewStatus(Metadata metadata, int maxAffectedResourcesCount) Creates a newShardsAvailabilityHealthIndicatorService.ShardAllocationStatusthat will be used to track primary and replica availability, providing the color, diagnosis, and messages about the available or unavailable shards in the cluster.abstract Diagnosis.Definitionabstract Diagnosis.Definitionabstract Diagnosis.Definitionabstract Diagnosis.Definitionprotected static Predicate<NodeAllocationResult> hasDeciderResult(String deciderName, Decision.Type outcome) Convenience method for filtering node allocation results by decider outcomes.name()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.health.HealthIndicatorService
calculate, createIndicator, isPreflight
-
Field Details
-
NAME
- See Also:
-
REPLICA_UNASSIGNED_BUFFER_TIME
-
clusterService
-
projectResolver
-
PRIMARY_UNASSIGNED_IMPACT_ID
- See Also:
-
READ_ONLY_PRIMARY_UNASSIGNED_IMPACT_ID
- See Also:
-
REPLICA_UNASSIGNED_IMPACT_ID
- See Also:
-
RESTORE_FROM_SNAPSHOT_ACTION_GUIDE
- See Also:
-
ACTION_RESTORE_FROM_SNAPSHOT
-
DIAGNOSE_SHARDS_ACTION_GUIDE
- See Also:
-
ACTION_CHECK_ALLOCATION_EXPLAIN_API
-
FIX_DELAYED_SHARDS_GUIDE
- See Also:
-
DIAGNOSIS_WAIT_FOR_OR_FIX_DELAYED_SHARDS
-
WAIT_FOR_INITIALIZATION_GUIDE
- See Also:
-
DIAGNOSIS_WAIT_FOR_INITIALIZATION
-
ENABLE_INDEX_ALLOCATION_GUIDE
- See Also:
-
ACTION_ENABLE_INDEX_ROUTING_ALLOCATION
-
ENABLE_CLUSTER_ALLOCATION_ACTION_GUIDE
- See Also:
-
ACTION_ENABLE_CLUSTER_ROUTING_ALLOCATION
-
ENABLE_TIER_ACTION_GUIDE
- See Also:
-
INCREASE_SHARD_LIMIT_ACTION_GUIDE
- See Also:
-
ACTION_INCREASE_SHARD_LIMIT_INDEX_SETTING
-
INCREASE_CLUSTER_SHARD_LIMIT_ACTION_GUIDE
- See Also:
-
ACTION_INCREASE_SHARD_LIMIT_CLUSTER_SETTING
-
TIER_CAPACITY_ACTION_GUIDE
- See Also:
-
ACTION_INCREASE_NODE_CAPACITY
-
-
Constructor Details
-
ShardsAvailabilityHealthIndicatorService
public ShardsAvailabilityHealthIndicatorService(ClusterService clusterService, AllocationService allocationService, SystemIndices systemIndices, ProjectResolver projectResolver)
-
-
Method Details
-
name
- Specified by:
namein interfaceHealthIndicatorService
-
createNewStatus
public abstract ShardsAvailabilityHealthIndicatorService.ShardAllocationStatus createNewStatus(Metadata metadata, int maxAffectedResourcesCount) Creates a newShardsAvailabilityHealthIndicatorService.ShardAllocationStatusthat will be used to track primary and replica availability, providing the color, diagnosis, and messages about the available or unavailable shards in the cluster.- Parameters:
metadata- Metadata for the clustermaxAffectedResourcesCount- Max number of affect resources to return- Returns:
- A new ShardAllocationStatus that has not yet been filled.
-
calculate
public HealthIndicatorResult calculate(boolean verbose, int maxAffectedResourcesCount, HealthInfo healthInfo) - Specified by:
calculatein interfaceHealthIndicatorService
-
hasDeciderResult
protected static Predicate<NodeAllocationResult> hasDeciderResult(String deciderName, Decision.Type outcome) Convenience method for filtering node allocation results by decider outcomes.- Parameters:
deciderName- The decider that is being checkedoutcome- The outcome expected- Returns:
- A predicate that returns true if the decision exists and matches the expected outcome, false otherwise.
-
checkNodeRoleRelatedIssues
protected abstract List<Diagnosis.Definition> checkNodeRoleRelatedIssues(IndexMetadata indexMetadata, List<NodeAllocationResult> nodeAllocationResults, ClusterState clusterState, ShardRouting shardRouting) Generates a list of diagnoses for common problems that keep a shard from allocating to nodes depending on their role; a very common example of such a case are data tiers.- Parameters:
indexMetadata- Index metadata for the shard being diagnosed.nodeAllocationResults- allocation decision results for all nodes in the cluster.clusterState- the current cluster state.shardRouting- the shard the nodeAllocationResults refer to- Returns:
- A list of diagnoses for the provided unassigned shard
-
checkNodesWithRoleAtShardLimit
protected List<Diagnosis.Definition> checkNodesWithRoleAtShardLimit(IndexMetadata indexMetadata, ClusterState clusterState, List<NodeAllocationResult> nodeRoleAllocationResults, Set<DiscoveryNode> nodesWithRoles, @Nullable String role) -
checkNotEnoughNodesWithRole
protected Optional<Diagnosis.Definition> checkNotEnoughNodesWithRole(List<NodeAllocationResult> nodeAllocationResults, @Nullable String role) -
getAddNodesWithRoleAction
-
getIncreaseShardLimitIndexSettingAction
-
getIncreaseShardLimitClusterSettingAction
@Nullable public abstract Diagnosis.Definition getIncreaseShardLimitClusterSettingAction(String role) -
getIncreaseNodeWithRoleCapacityAction
-