mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
don't overflow with cluster events if the index level block was removed already
This commit is contained in:
parent
36bf5ee9fe
commit
8ceba0dca1
@ -178,6 +178,14 @@ public class GatewayService extends AbstractLifecycleComponent<GatewayService> i
|
|||||||
if (indexRoutingTable != null && indexRoutingTable.allPrimaryShardsActive()) {
|
if (indexRoutingTable != null && indexRoutingTable.allPrimaryShardsActive()) {
|
||||||
clusterService.submitStateUpdateTask("remove-index-block (all primary shards active for [" + index + "])", new ClusterStateUpdateTask() {
|
clusterService.submitStateUpdateTask("remove-index-block (all primary shards active for [" + index + "])", new ClusterStateUpdateTask() {
|
||||||
@Override public ClusterState execute(ClusterState currentState) {
|
@Override public ClusterState execute(ClusterState currentState) {
|
||||||
|
// check if the block was removed...
|
||||||
|
if (!currentState.blocks().indices().containsKey(index)) {
|
||||||
|
return currentState;
|
||||||
|
}
|
||||||
|
// check if the block was removed...
|
||||||
|
if (!currentState.blocks().indices().get(index).contains(GatewayService.INDEX_NOT_RECOVERED_BLOCK)) {
|
||||||
|
return currentState;
|
||||||
|
}
|
||||||
ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
|
ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks());
|
||||||
blocks.removeIndexBlock(index, GatewayService.INDEX_NOT_RECOVERED_BLOCK);
|
blocks.removeIndexBlock(index, GatewayService.INDEX_NOT_RECOVERED_BLOCK);
|
||||||
return ClusterState.builder().state(currentState).blocks(blocks).build();
|
return ClusterState.builder().state(currentState).blocks(blocks).build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user