Class MetadataIndexStateService

java.lang.Object
org.elasticsearch.cluster.metadata.MetadataIndexStateService

public class MetadataIndexStateService extends Object
Service responsible for submitting open/close index requests as well as for adding index blocks
  • Field Details

    • INDEX_CLOSED_BLOCK_ID

      public static final int INDEX_CLOSED_BLOCK_ID
      See Also:
    • INDEX_CLOSED_BLOCK

      public static final ClusterBlock INDEX_CLOSED_BLOCK
    • VERIFIED_BEFORE_CLOSE_SETTING

      public static final Setting<Boolean> VERIFIED_BEFORE_CLOSE_SETTING
  • Constructor Details

  • Method Details

    • closeIndices

      public void closeIndices(CloseIndexClusterStateUpdateRequest request, ActionListener<CloseIndexResponse> listener)
      Closes one or more indices. Closing indices is a 3 steps process: it first adds a write block to every indices to close, then waits for the operations on shards to be terminated and finally closes the indices by moving their state to CLOSE.
    • addIndexBlock

      public void addIndexBlock(AddIndexBlockClusterStateUpdateRequest request, ActionListener<AddIndexBlockResponse> listener)
      Adds an index block based on the given request, and notifies the listener upon completion. Adding blocks is done in three steps: - First, a temporary UUID-based block is added to the index (see addIndexBlock(Index[], ClusterState, APIBlock). - Second, shards are checked to have properly applied the UUID-based block. (see MetadataIndexStateService.WaitForBlocksApplied). - Third, the temporary UUID-based block is turned into a full block (see finalizeBlock(ClusterState, Map, Map, APIBlock). Using this three-step process ensures non-interference by other operations in case where we notify successful completion here.
    • openIndex

    • createIndexClosingBlock

      public static ClusterBlock createIndexClosingBlock()
      Returns:
      Generates a ClusterBlock that blocks read and write operations on soon-to-be-closed indices. The cluster block is generated with the id value equals to INDEX_CLOSED_BLOCK_ID and a unique UUID.
    • isIndexVerifiedBeforeClosed

      public static boolean isIndexVerifiedBeforeClosed(IndexMetadata indexMetadata)
    • createUUIDBasedBlock

      public static ClusterBlock createUUIDBasedBlock(ClusterBlock clusterBlock)