Interface IndicesClusterStateService.AllocatedIndices<T extends IndicesClusterStateService.Shard,U extends IndicesClusterStateService.AllocatedIndex<T>>
- All Superinterfaces:
Iterable<U>
- All Known Implementing Classes:
IndicesService
- Enclosing class:
- IndicesClusterStateService
public static interface IndicesClusterStateService.AllocatedIndices<T extends IndicesClusterStateService.Shard,U extends IndicesClusterStateService.AllocatedIndex<T>>
extends Iterable<U>
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
-
Method Summary
Modifier and TypeMethodDescriptioncreateIndex(IndexMetadata indexMetadata, List<IndexEventListener> builtInIndexListener, boolean writeDanglingIndices)
Creates a newIndexService
for the given metadata.createShard(ShardRouting shardRouting, PeerRecoveryTargetService recoveryTargetService, PeerRecoveryTargetService.RecoveryListener recoveryListener, RepositoriesService repositoriesService, Consumer<IndexShard.ShardFailure> onShardFailure, Consumer<ShardId> globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer, DiscoveryNode targetNode, DiscoveryNode sourceNode)
Creates a shard for the specified shard routing and starts recovery.void
deleteUnassignedIndex(String reason, IndexMetadata metadata, ClusterState clusterState)
Deletes an index that is not assigned to this node.default T
getShardOrNull(ShardId shardId)
Returns shard for the specified id if it exists otherwise returnsnull
.indexService(Index index)
Returns an IndexService for the specified index if exists otherwise returnsnull
.void
processPendingDeletes(Index index, IndexSettings indexSettings, org.elasticsearch.core.TimeValue timeValue)
void
removeIndex(Index index, IndicesClusterStateService.AllocatedIndices.IndexRemovalReason reason, String extraInfo)
Removes the given index from this service and releases all associated resources.verifyIndexIsDeleted(Index index, ClusterState clusterState)
Verify that the contents on disk for the given index is deleted; if not, delete the contents.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
createIndex
U createIndex(IndexMetadata indexMetadata, List<IndexEventListener> builtInIndexListener, boolean writeDanglingIndices) throws IOExceptionCreates a newIndexService
for the given metadata.- Parameters:
indexMetadata
- the index metadata to create the index forbuiltInIndexListener
- a list of built-in lifecycleIndexEventListener
that should should be used along side with the per-index listenerswriteDanglingIndices
- whether dangling indices information should be written- Throws:
ResourceAlreadyExistsException
- if the index already exists.IOException
-
verifyIndexIsDeleted
Verify that the contents on disk for the given index is deleted; if not, delete the contents. This method assumes that an index is already deleted in the cluster state and/or explicitly through index tombstones.- Parameters:
index
-Index
to make sure its deleted from diskclusterState
-ClusterState
to ensure the index is not part of it- Returns:
- IndexMetadata for the index loaded from disk
-
deleteUnassignedIndex
Deletes an index that is not assigned to this node. This method cleans up all disk folders relating to the index but does not deal with in-memory structures. For those callremoveIndex(Index, IndexRemovalReason, String)
-
removeIndex
void removeIndex(Index index, IndicesClusterStateService.AllocatedIndices.IndexRemovalReason reason, String extraInfo)Removes the given index from this service and releases all associated resources. Persistent parts of the index like the shards files, state and transaction logs are kept around in the case of a disaster recovery.- Parameters:
index
- the index to removereason
- the reason to remove the indexextraInfo
- extra information that will be used for logging and reporting
-
indexService
Returns an IndexService for the specified index if exists otherwise returnsnull
. -
createShard
T createShard(ShardRouting shardRouting, PeerRecoveryTargetService recoveryTargetService, PeerRecoveryTargetService.RecoveryListener recoveryListener, RepositoriesService repositoriesService, Consumer<IndexShard.ShardFailure> onShardFailure, Consumer<ShardId> globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer, DiscoveryNode targetNode, @Nullable DiscoveryNode sourceNode) throws IOExceptionCreates a shard for the specified shard routing and starts recovery.- Parameters:
shardRouting
- the shard routingrecoveryTargetService
- recovery service for the targetrecoveryListener
- a callback when recovery changes state (finishes or fails)repositoriesService
- service responsible for snapshot/restoreonShardFailure
- a callback when this shard failsglobalCheckpointSyncer
- a callback when this shard syncs the global checkpointretentionLeaseSyncer
- a callback when this shard syncs retention leasestargetNode
- the node where this shard will be recoveredsourceNode
- the source node to recover this shard from (it might be null)- Returns:
- a new shard
- Throws:
IOException
- if an I/O exception occurs when creating the shard
-
getShardOrNull
Returns shard for the specified id if it exists otherwise returnsnull
. -
processPendingDeletes
void processPendingDeletes(Index index, IndexSettings indexSettings, org.elasticsearch.core.TimeValue timeValue) throws IOException, InterruptedException, ShardLockObtainFailedException
-