Add cluster.blocks.read.auto_release setting#20633
Add cluster.blocks.read.auto_release setting#20633drtootsie wants to merge 1 commit intoopensearch-project:mainfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR adds conditional auto-release functionality for read-blocks in disk threshold management. It introduces a new dynamic cluster setting that gates automatic read-block release logic, allowing operators to control whether blocked indices are automatically unblocked when disk conditions improve. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
server/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdMonitor.java (1)
496-527:⚠️ Potential issue | 🟠 MajorApply
indicesNotToAutoReleasefilter toindicesToReleaseReadBlockinhandleReadBlocks.The read-only block auto-release in
handleReadOnlyBlocks(line 456) filters outindicesNotToAutoReleaseto prevent releasing blocks on flood-stage, high-watermark, or nodes with missing usage data. However,handleReadBlocksdoes not apply this same filter toindicesToReleaseReadBlock, allowing read blocks to be auto-released on indices that should remain blocked. This creates an asymmetry where read-only blocks are protected but read blocks are not.Pass
indicesNotToAutoReleasetohandleReadBlocksand apply the same filter toindicesToReleaseReadBlock(around line 499-506) to match the pattern inhandleReadOnlyBlocks.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
server/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdMonitor.javaserver/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdSettings.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-13T17:40:27.167Z
Learnt from: reta
Repo: opensearch-project/OpenSearch PR: 20411
File: server/src/main/java/org/opensearch/index/codec/CodecService.java:112-133
Timestamp: 2026-01-13T17:40:27.167Z
Learning: Avoid capturing or evaluating a supplier (e.g., this::defaultCodec) upfront when passing it to a registry during object construction. If registries may replace defaults during iteration (as in EnginePlugin.getAdditionalCodecs), pass the supplier itself and only resolve it at use time. This ensures dynamic behavior is preserved during initialization and prevents premature binding of defaults in codecs/registry setup. This pattern should apply to similar initialization paths in Java server code where registries may mutate defaults during construction.
Applied to files:
server/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdMonitor.javaserver/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdSettings.java
🔇 Additional comments (2)
server/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdSettings.java (1)
117-122: Clean, consistent addition mirroring the existingcreateIndexBlockAutoReleaseEnabledpattern.Setting definition, volatile field, constructor init, update consumer registration, setter, and getter all follow the established convention. LGTM.
Also applies to: 132-132, 163-163, 175-175, 377-379, 439-441
server/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdMonitor.java (1)
497-509: Correct conditional gating of read-block auto-release.The toggle cleanly wraps the existing release computation and falls back to an immutable empty set when disabled. This is consistent with how
isCreateIndexBlockAutoReleaseEnabled()gates the create-index block release inhandleClusterCreateIndexBlocks.
|
❌ Gradle check result for 10ce8c8: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Addresses opensearch-project#20539 DiskThresholdMonitor unconditionally auto-releases index.blocks.read on all indices, even when manually set by users. This was designed for warm node file cache threshold protection but affects all nodes. Changes: - Add CLUSTER_READ_BLOCK_AUTO_RELEASE setting (default: true) - Check isReadBlockAutoReleaseEnabled() before auto-releasing read blocks - Follows same pattern as CLUSTER_CREATE_INDEX_BLOCK_AUTO_RELEASE Users can now disable auto-release: PUT /_cluster/settings { "persistent": { "cluster.blocks.read.auto_release": false } } This allows manually-set read blocks to persist until explicitly removed. Signed-off-by: Pepper Pancoast <ppancoast@ntst.com>
10ce8c8 to
a493f8b
Compare
|
❌ Gradle check result for a493f8b: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Addresses #20539
Problem
DiskThresholdMonitorunconditionally auto-releasesindex.blocks.readon all indices, even when manually set by users. This setting was added to support warm node file cache threshold protection, but the implementation assumesindex.blocks.readis only used by the system.Unlike
cluster.blocks.create_indexwhich hascluster.blocks.create_index.auto_releaseto control this behavior, there is no equivalent setting forindex.blocks.read.Solution
Add
cluster.blocks.read.auto_releasesetting to control read block auto-release behavior, following the same pattern ascluster.blocks.create_index.auto_release.Changes
In
DiskThresholdMonitor.handleReadBlocks():Usage
Users can disable auto-release to preserve manually-set read blocks:
Testing
index.blocks.read: truemanually on an indexcluster.blocks.read.auto_release: false: block persistsImpact