Class MetadataIndexStateService
java.lang.Object
org.elasticsearch.cluster.metadata.MetadataIndexStateService
Service responsible for submitting open/close index requests as well as for adding index blocks
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMetadataIndexStateService(ClusterService clusterService, AllocationService allocationService, IndexMetadataVerifier indexMetadataVerifier, IndicesService indicesService, ShardLimitValidator shardLimitValidator, ThreadPool threadPool, TransportVerifyShardBeforeCloseAction transportVerifyShardBeforeCloseAction, TransportVerifyShardIndexBlockAction transportVerifyShardIndexBlockAction)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addIndexBlock(AddIndexBlockClusterStateUpdateRequest request, ActionListener<AddIndexBlockResponse> listener)
Adds an index block based on the given request, and notifies the listener upon completion.void
closeIndices(CloseIndexClusterStateUpdateRequest request, ActionListener<CloseIndexResponse> listener)
Closes one or more indices.static ClusterBlock
static ClusterBlock
createUUIDBasedBlock(ClusterBlock clusterBlock)
static boolean
isIndexVerifiedBeforeClosed(IndexMetadata indexMetadata)
void
openIndex(OpenIndexClusterStateUpdateRequest request, ActionListener<ShardsAcknowledgedResponse> listener)
-
Field Details
-
INDEX_CLOSED_BLOCK_ID
public static final int INDEX_CLOSED_BLOCK_ID- See Also:
- Constant Field Values
-
INDEX_CLOSED_BLOCK
-
VERIFIED_BEFORE_CLOSE_SETTING
-
-
Constructor Details
-
MetadataIndexStateService
@Inject public MetadataIndexStateService(ClusterService clusterService, AllocationService allocationService, IndexMetadataVerifier indexMetadataVerifier, IndicesService indicesService, ShardLimitValidator shardLimitValidator, ThreadPool threadPool, TransportVerifyShardBeforeCloseAction transportVerifyShardBeforeCloseAction, TransportVerifyShardIndexBlockAction transportVerifyShardIndexBlockAction)
-
-
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 (seeaddIndexBlock(Index[], ClusterState, APIBlock)
. - Second, shards are checked to have properly applied the UUID-based block. (seeMetadataIndexStateService.WaitForBlocksApplied
). - Third, the temporary UUID-based block is turned into a full block (seefinalizeBlock(ClusterState, Map, Map, APIBlock)
. Using this three-step process ensures non-interference by other operations in case where we notify successful completion here. -
openIndex
public void openIndex(OpenIndexClusterStateUpdateRequest request, ActionListener<ShardsAcknowledgedResponse> listener) -
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 toINDEX_CLOSED_BLOCK_ID
and a unique UUID.
-
isIndexVerifiedBeforeClosed
-
createUUIDBasedBlock
-