Class DanglingIndicesState

java.lang.Object
org.elasticsearch.gateway.DanglingIndicesState
All Implemented Interfaces:
ClusterStateListener

public class DanglingIndicesState
extends java.lang.Object
implements ClusterStateListener
The dangling indices state is responsible for finding new dangling indices (indices that have their state written on disk, but don't exists in the metadata of the cluster), and importing them into the cluster.
  • Field Summary

    Fields
    Modifier and Type Field Description
    static Setting<java.lang.Boolean> AUTO_IMPORT_DANGLING_INDICES_SETTING
    Controls whether dangling indices should be automatically detected and imported into the cluster state upon discovery.
  • Constructor Summary

    Constructors
    Constructor Description
    DanglingIndicesState​(NodeEnvironment nodeEnv, MetaStateService metaStateService, LocalAllocateDangledIndices danglingIndicesAllocator, ClusterService clusterService)  
  • Method Summary

    Modifier and Type Method Description
    void clusterChanged​(ClusterChangedEvent event)
    Called when cluster state changes.
    java.util.Map<Index,​IndexMetadata> findNewDanglingIndices​(java.util.Map<Index,​IndexMetadata> existingDanglingIndices, Metadata metadata)
    Finds new dangling indices by iterating over the indices and trying to find indices that have state on disk, but are not part of the provided metadata, or not detected as dangled already.
    java.util.Map<Index,​IndexMetadata> getDanglingIndices()
    Either return the current set of dangling indices, if auto-import is enabled, otherwise scan for dangling indices right away.
    void processDanglingIndices​(Metadata metadata)
    Process dangling indices based on the provided meta data, handling cleanup, finding new dangling indices, and allocating outstanding ones.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • AUTO_IMPORT_DANGLING_INDICES_SETTING

      public static final Setting<java.lang.Boolean> AUTO_IMPORT_DANGLING_INDICES_SETTING
      Controls whether dangling indices should be automatically detected and imported into the cluster state upon discovery. This setting is deprecated - use the _dangling API instead. If disabled, dangling indices will not be automatically detected.
      See Also:
      org.elasticsearch.action.admin.indices.dangling
  • Constructor Details

  • Method Details

    • processDanglingIndices

      public void processDanglingIndices​(Metadata metadata)
      Process dangling indices based on the provided meta data, handling cleanup, finding new dangling indices, and allocating outstanding ones.
    • getDanglingIndices

      public java.util.Map<Index,​IndexMetadata> getDanglingIndices()
      Either return the current set of dangling indices, if auto-import is enabled, otherwise scan for dangling indices right away.
      Returns:
      a map of currently-known dangling indices
    • findNewDanglingIndices

      public java.util.Map<Index,​IndexMetadata> findNewDanglingIndices​(java.util.Map<Index,​IndexMetadata> existingDanglingIndices, Metadata metadata)
      Finds new dangling indices by iterating over the indices and trying to find indices that have state on disk, but are not part of the provided metadata, or not detected as dangled already.
    • clusterChanged

      public void clusterChanged​(ClusterChangedEvent event)
      Description copied from interface: ClusterStateListener
      Called when cluster state changes.
      Specified by:
      clusterChanged in interface ClusterStateListener