Class DanglingIndicesState

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

public class DanglingIndicesState extends 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.
Opensearch.internal:
  • Field Details

    • AUTO_IMPORT_DANGLING_INDICES_SETTING

      public static final Setting<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:
  • 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 Map<org.opensearch.core.index.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 Map<org.opensearch.core.index.Index,IndexMetadata> findNewDanglingIndices(Map<org.opensearch.core.index.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