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>
  • Method Details

    • createIndex

      U createIndex(IndexMetadata indexMetadata, List<IndexEventListener> builtInIndexListener, boolean writeDanglingIndices) throws IOException
      Creates a new IndexService for the given metadata.
      Parameters:
      indexMetadata - the index metadata to create the index for
      builtInIndexListener - a list of built-in lifecycle IndexEventListener that should should be used along side with the per-index listeners
      writeDanglingIndices - whether dangling indices information should be written
      Throws:
      ResourceAlreadyExistsException - if the index already exists.
      IOException
    • verifyIndexIsDeleted

      IndexMetadata verifyIndexIsDeleted(Index index, ClusterState clusterState)
      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 disk
      clusterState - ClusterState to ensure the index is not part of it
      Returns:
      IndexMetadata for the index loaded from disk
    • deleteUnassignedIndex

      void deleteUnassignedIndex(String reason, IndexMetadata oldIndexMetadata, @Nullable ProjectMetadata currentProject)
      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 call removeIndex(org.elasticsearch.index.Index, org.elasticsearch.indices.cluster.IndexRemovalReason, java.lang.String, java.util.concurrent.Executor, org.elasticsearch.action.ActionListener<java.lang.Void>)
      Parameters:
      reason - the reason why this index should be deleted
      oldIndexMetadata - the index metadata of the index that should be deleted
      currentProject - the current project metadata which is used to verify that the index does not exist in the project anymore - can be null in case the whole project got deleted while there were still indices in it
    • removeIndex

      void removeIndex(Index index, IndexRemovalReason reason, String extraInfo, Executor shardCloseExecutor, ActionListener<Void> shardsClosedListener)
      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 remove
      reason - the reason to remove the index
      extraInfo - extra information that will be used for logging and reporting
      shardCloseExecutor - executor to use to close individual shards
      shardsClosedListener - listener which is completed when all shards have been closed
    • indexService

      @Nullable U indexService(Index index)
      Returns an IndexService for the specified index if exists otherwise returns null.
    • createShard

      void createShard(ShardRouting shardRouting, PeerRecoveryTargetService recoveryTargetService, PeerRecoveryTargetService.RecoveryListener recoveryListener, RepositoriesService repositoriesService, Consumer<IndexShard.ShardFailure> onShardFailure, GlobalCheckpointSyncer globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer, DiscoveryNode targetNode, @Nullable DiscoveryNode sourceNode, long clusterStateVersion) throws IOException
      Creates a shard for the specified shard routing and starts recovery.
      Parameters:
      shardRouting - the shard routing
      recoveryTargetService - recovery service for the target
      recoveryListener - a callback when recovery changes state (finishes or fails)
      repositoriesService - service responsible for snapshot/restore
      onShardFailure - a callback when this shard fails
      globalCheckpointSyncer - a callback when this shard syncs the global checkpoint
      retentionLeaseSyncer - a callback when this shard syncs retention leases
      targetNode - the node where this shard will be recovered
      sourceNode - the source node to recover this shard from (it might be null)
      clusterStateVersion - the cluster state version in which the shard was created
      Throws:
      IOException - if an I/O exception occurs when creating the shard
    • getShardOrNull

      default T getShardOrNull(ShardId shardId)
      Returns shard for the specified id if it exists otherwise returns null.
    • processPendingDeletes

      void processPendingDeletes(Index index, IndexSettings indexSettings, TimeValue timeValue) throws IOException, InterruptedException, ShardLockObtainFailedException
      Throws:
      IOException
      InterruptedException
      ShardLockObtainFailedException