java.lang.Object
org.elasticsearch.xpack.core.ilm.PhaseCacheManagement
We cache the currently executing ILM phase in the index metadata so the ILM execution for managed indices is not irrecoverably
interrupted by a concurrent update policy that, say, would remove the current execution phase altogether.
This contains class contains a series of methods that help manage the cached ILM phase.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleaneligibleToCheckForRefresh(IndexMetadata metadata) Ensure that we have the minimum amount of metadata necessary to check for cache phase refresh.static booleanisIndexPhaseDefinitionUpdatable(org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, Client client, IndexMetadata metadata, LifecyclePolicy newPolicy, XPackLicenseState licenseState) Returns 'true' if the index's cached phase JSON can be safely reread, 'false' otherwise.static voidrefreshPhaseDefinition(ProjectMetadata.Builder projectMetadataBuilder, IndexMetadata idxMeta, LifecyclePolicyMetadata updatedPolicy) Rereads the phase JSON for the given index, and updates the provided metadata.static ProjectMetadatarefreshPhaseDefinition(ProjectMetadata projectMetadata, String index, LifecyclePolicyMetadata updatedPolicy) Rereads the phase JSON for the given index, returning a new cluster state.static booleanupdateIndicesForPolicy(ProjectMetadata.Builder projectMetadataBuilder, ProjectMetadata projectMetadata, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, Client client, LifecyclePolicy oldPolicy, LifecyclePolicyMetadata newPolicy, XPackLicenseState licenseState) For the given new policy, update the provided metadata to reflect the refreshed phase JSON for all updateable indices.static ProjectMetadataupdateIndicesForPolicy(ProjectMetadata projectMetadata, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, Client client, LifecyclePolicy oldPolicy, LifecyclePolicyMetadata newPolicy, XPackLicenseState licenseState) For the given new policy, returns a new cluster with all updateable indices' phase JSON refreshed.
-
Method Details
-
refreshPhaseDefinition
public static ProjectMetadata refreshPhaseDefinition(ProjectMetadata projectMetadata, String index, LifecyclePolicyMetadata updatedPolicy) Rereads the phase JSON for the given index, returning a new cluster state. -
refreshPhaseDefinition
public static void refreshPhaseDefinition(ProjectMetadata.Builder projectMetadataBuilder, IndexMetadata idxMeta, LifecyclePolicyMetadata updatedPolicy) Rereads the phase JSON for the given index, and updates the provided metadata. -
eligibleToCheckForRefresh
Ensure that we have the minimum amount of metadata necessary to check for cache phase refresh. This includes: - An execution state - Existing phase definition JSON - A current step key - A current phase in the step key - Not currently in the ERROR step -
updateIndicesForPolicy
public static ProjectMetadata updateIndicesForPolicy(ProjectMetadata projectMetadata, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, Client client, LifecyclePolicy oldPolicy, LifecyclePolicyMetadata newPolicy, XPackLicenseState licenseState) For the given new policy, returns a new cluster with all updateable indices' phase JSON refreshed. -
updateIndicesForPolicy
public static boolean updateIndicesForPolicy(ProjectMetadata.Builder projectMetadataBuilder, ProjectMetadata projectMetadata, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, Client client, LifecyclePolicy oldPolicy, LifecyclePolicyMetadata newPolicy, XPackLicenseState licenseState) For the given new policy, update the provided metadata to reflect the refreshed phase JSON for all updateable indices. Returns true if any indices were updated and false otherwise. Users of this API should consider the returned value and only create a newClusterStateif `true` is returned. -
isIndexPhaseDefinitionUpdatable
public static boolean isIndexPhaseDefinitionUpdatable(org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, Client client, IndexMetadata metadata, LifecyclePolicy newPolicy, XPackLicenseState licenseState) Returns 'true' if the index's cached phase JSON can be safely reread, 'false' otherwise.
-