Package org.opensearch.gateway
Class DanglingIndicesState
java.lang.Object
org.opensearch.gateway.DanglingIndicesState
- All Implemented Interfaces:
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 Summary
Modifier and TypeFieldDescriptionControls whether dangling indices should be automatically detected and imported into the cluster state upon discovery. -
Constructor Summary
ConstructorDescriptionDanglingIndicesState
(NodeEnvironment nodeEnv, MetaStateService metaStateService, LocalAllocateDangledIndices danglingIndicesAllocator, ClusterService clusterService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when cluster state changes.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.Map
<org.opensearch.core.index.Index, IndexMetadata> 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.
-
Field Details
-
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
-
DanglingIndicesState
@Inject public DanglingIndicesState(NodeEnvironment nodeEnv, MetaStateService metaStateService, LocalAllocateDangledIndices danglingIndicesAllocator, ClusterService clusterService)
-
-
Method Details
-
processDanglingIndices
Process dangling indices based on the provided meta data, handling cleanup, finding new dangling indices, and allocating outstanding ones. -
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
Description copied from interface:ClusterStateListener
Called when cluster state changes.- Specified by:
clusterChanged
in interfaceClusterStateListener
-