Description
The Problem
The DiskThresholdMonitor
in Elasticsearch monitors for disk utilization across nodes periodically based on cluster.info.update.interval
and ends up putting a INDEX_READ_ONLY_ALLOW_DELETE_BLOCK
on every index that has atleast one shard on a node that breaches cluster.routing.allocation.disk.watermark.flood_stage
but leaves those indices in the same state even after disk frees up, putting the onus on the end user to manually unblock those indices. This issue has been initiated as a part of #24299(comment)
Proposed Solution
The master is already checking for disk utilization across nodes to see if nodes are going over the flood
threshold. So if we find any index block in the cluster state that should no longer be blocked based on the latest run of the disk monitor we should go ahead unblock those indices. The solution should mark index block which breach the threshold as INDEX_READ_ONLY_ALLOW_DELETE_BLOCK
and the unblock the ones which already have blocks based on state.getBlocks().indexBlocked(ClusterBlockLevel.WRITE, index)
but no longer match the indices. The only challenge would be to distinguish a customer requested block for SETTING_READ_ONLY_ALLOW_DELETE
vs the one added by the disk monitor. To solve this we can either introduce a parameter in the request and a separate block to mark the indices from monitor differently.