Class PhaseCacheManagement

java.lang.Object
org.elasticsearch.xpack.core.ilm.PhaseCacheManagement

public final class PhaseCacheManagement extends Object
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 Details

    • refreshPhaseDefinition

      public static ClusterState refreshPhaseDefinition(ClusterState state, String index, LifecyclePolicyMetadata updatedPolicy)
      Rereads the phase JSON for the given index, returning a new cluster state.
    • refreshPhaseDefinition

      public static void refreshPhaseDefinition(Metadata.Builder metadataBuilder, IndexMetadata idxMeta, LifecyclePolicyMetadata updatedPolicy)
      Rereads the phase JSON for the given index, and updates the provided metadata.
    • eligibleToCheckForRefresh

      public static boolean eligibleToCheckForRefresh(IndexMetadata metadata)
      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 ClusterState updateIndicesForPolicy(ClusterState state, 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(Metadata.Builder mb, ClusterState currentState, 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 new ClusterState if `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.