Skip to content

[BUG] DiskThresholdMonitor unconditionally auto-releases user-set index.blocks.read setting #20539

@karenyrx

Description

@karenyrx

Describe the bug

The DiskThresholdMonitor introduced in #19071 unconditionally auto-releases index.blocks.read on all indices, even when manually set by users. This setting was added to support warm node file cache threshold protection, but the implementation assumes index.blocks.read is only used by the system. Unlike cluster.blocks.create_index which has cluster.blocks.create_index.auto_release to control this behavior, there is no equivalent setting for index.blocks.read.

Related component

Search

To Reproduce

  1. Start an OpenSearch cluster (any node type, not just warm nodes)
  2. Create an index: PUT /test-index
  3. Set read block: PUT /test-index/_settings with {"index.blocks.read": true}
  4. Wait ~1-2 seconds for DiskThresholdMonitor to run
  5. Check settings: GET /test-index/_settings
  6. Observe index.blocks.read has been automatically unset to false

Expected behavior

Manually-set index.blocks.read should persist until explicitly removed by the user. The auto-release behavior should either:

  1. Be disabled by default (breaking change), OR
  2. Be controllable via a new setting cluster.blocks.read.auto_release (similar to cluster.blocks.create_index.auto_release), OR
  3. Only apply to blocks that were set by the system (file cache mechanism)

Additional Details

In DiskThresholdMonitor.handleReadBlocks(), the code releases INDEX_READ_BLOCK on any index not in indicesToBlockRead. The indicesToBlockRead set is only populated for warm nodes exceeding file cache search threshold. For all other nodes/indices, this set is empty, causing ALL read blocks to be auto-released.

private void handleReadBlocks(ClusterState state, Set<String> indicesToBlockRead, ActionListener<Void> listener) {
    final Set<String> indicesToReleaseReadBlock = StreamSupport.stream(...)
        .filter(index -> indicesToBlockRead.contains(index) == false)  // Always true for non-warm nodes
        .filter(index -> state.getBlocks().hasIndexBlock(index, IndexMetadata.INDEX_READ_BLOCK))
        .collect(Collectors.toSet());
    
    if (indicesToReleaseReadBlock.isEmpty() == false) {
        updateIndicesReadBlock(indicesToReleaseReadBlock, listener, false);  //  <<<<< Unconditionally released 
    }
}

Suggested fix: Add cluster.blocks.read.auto_release setting to DiskThresholdSettings, similar to CLUSTER_CREATE_INDEX_BLOCK_AUTO_RELEASE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SearchSearch query, autocomplete ...etcbugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions