Skip to content

Commit 4ffda01

Browse files
committed
Always auto release the flood stage block
Removes support for using a system property to disable the automatic release of the write block applied when a node exceeds the flood-stage watermark. Signed-off-by: Nicholas Walter Knize <[email protected]>
1 parent a2f95ce commit 4ffda01

File tree

4 files changed

+11
-48
lines changed

4 files changed

+11
-48
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
7979
### Removed
8080
- Remove deprecated code to add node name into log pattern of log4j property file ([#4568](https://github.com/opensearch-project/OpenSearch/pull/4568))
8181
- Unused object and import within TransportClusterAllocationExplainAction ([#4639](https://github.com/opensearch-project/OpenSearch/pull/4639))
82+
- Always auto release the flood stage block ([#4703](https://github.com/opensearch-project/OpenSearch/pull/4703))
8283

8384
### Fixed
8485

server/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdMonitor.java

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.apache.logging.log4j.LogManager;
3838
import org.apache.logging.log4j.Logger;
3939
import org.apache.logging.log4j.message.ParameterizedMessage;
40-
import org.opensearch.LegacyESVersion;
4140
import org.opensearch.action.ActionListener;
4241
import org.opensearch.action.support.GroupedActionListener;
4342
import org.opensearch.client.Client;
@@ -54,7 +53,6 @@
5453
import org.opensearch.common.Priority;
5554
import org.opensearch.common.Strings;
5655
import org.opensearch.common.collect.ImmutableOpenMap;
57-
import org.opensearch.common.logging.DeprecationLogger;
5856
import org.opensearch.common.settings.ClusterSettings;
5957
import org.opensearch.common.settings.Settings;
6058
import org.opensearch.common.util.set.Sets;
@@ -88,7 +86,6 @@ public class DiskThresholdMonitor {
8886
private final RerouteService rerouteService;
8987
private final AtomicLong lastRunTimeMillis = new AtomicLong(Long.MIN_VALUE);
9088
private final AtomicBoolean checkInProgress = new AtomicBoolean();
91-
private final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(logger.getName());
9289

9390
/**
9491
* The IDs of the nodes that were over the low threshold in the last check (and maybe over another threshold too). Tracked so that we
@@ -121,14 +118,6 @@ public DiskThresholdMonitor(
121118
this.rerouteService = rerouteService;
122119
this.diskThresholdSettings = new DiskThresholdSettings(settings, clusterSettings);
123120
this.client = client;
124-
if (diskThresholdSettings.isAutoReleaseIndexEnabled() == false) {
125-
deprecationLogger.deprecate(
126-
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY.replace(".", "_"),
127-
"[{}] will be removed in version {}",
128-
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY,
129-
LegacyESVersion.V_7_4_0.major + 1
130-
);
131-
}
132121
}
133122

134123
private void checkFinished() {
@@ -371,23 +360,7 @@ public void onNewInfo(ClusterInfo info) {
371360
.collect(Collectors.toSet());
372361

373362
if (indicesToAutoRelease.isEmpty() == false) {
374-
if (diskThresholdSettings.isAutoReleaseIndexEnabled()) {
375-
logger.info("releasing read-only-allow-delete block on indices: [{}]", indicesToAutoRelease);
376-
updateIndicesReadOnly(indicesToAutoRelease, listener, false);
377-
} else {
378-
deprecationLogger.deprecate(
379-
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY.replace(".", "_"),
380-
"[{}] will be removed in version {}",
381-
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY,
382-
LegacyESVersion.V_7_4_0.major + 1
383-
);
384-
logger.debug(
385-
"[{}] disabled, not releasing read-only-allow-delete block on indices: [{}]",
386-
DiskThresholdSettings.AUTO_RELEASE_INDEX_ENABLED_KEY,
387-
indicesToAutoRelease
388-
);
389-
listener.onResponse(null);
390-
}
363+
updateIndicesReadOnly(indicesToAutoRelease, listener, false);
391364
} else {
392365
logger.trace("no auto-release required");
393366
listener.onResponse(null);
@@ -421,11 +394,9 @@ private void markNodesMissingUsageIneligibleForRelease(
421394
) {
422395
for (RoutingNode routingNode : routingNodes) {
423396
if (usages.containsKey(routingNode.nodeId()) == false) {
424-
if (routingNode != null) {
425-
for (ShardRouting routing : routingNode) {
426-
String indexName = routing.index().getName();
427-
indicesToMarkIneligibleForAutoRelease.add(indexName);
428-
}
397+
for (ShardRouting routing : routingNode) {
398+
String indexName = routing.index().getName();
399+
indicesToMarkIneligibleForAutoRelease.add(indexName);
429400
}
430401
}
431402
}

server/src/main/java/org/opensearch/cluster/routing/allocation/DiskThresholdSettings.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
package org.opensearch.cluster.routing.allocation;
3434

3535
import org.opensearch.OpenSearchParseException;
36+
import org.opensearch.Version;
3637
import org.opensearch.common.Strings;
3738
import org.opensearch.common.settings.ClusterSettings;
3839
import org.opensearch.common.settings.Setting;
@@ -108,19 +109,14 @@ public class DiskThresholdSettings {
108109
private volatile TimeValue rerouteInterval;
109110
private volatile Double freeDiskThresholdFloodStage;
110111
private volatile ByteSizeValue freeBytesThresholdFloodStage;
111-
private static final boolean autoReleaseIndexEnabled;
112-
public static final String AUTO_RELEASE_INDEX_ENABLED_KEY = "opensearch.disk.auto_release_flood_stage_block";
113112

114113
static {
114+
assert Version.CURRENT.major == Version.V_2_0_0.major + 1; // this check is unnecessary in v4
115+
final String AUTO_RELEASE_INDEX_ENABLED_KEY = "opensearch.disk.auto_release_flood_stage_block";
116+
115117
final String property = System.getProperty(AUTO_RELEASE_INDEX_ENABLED_KEY);
116-
if (property == null) {
117-
autoReleaseIndexEnabled = true;
118-
} else if (Boolean.FALSE.toString().equals(property)) {
119-
autoReleaseIndexEnabled = false;
120-
} else {
121-
throw new IllegalArgumentException(
122-
AUTO_RELEASE_INDEX_ENABLED_KEY + " may only be unset or set to [false] but was [" + property + "]"
123-
);
118+
if (property != null) {
119+
throw new IllegalArgumentException("system property [" + AUTO_RELEASE_INDEX_ENABLED_KEY + "] may not be set");
124120
}
125121
}
126122

@@ -371,10 +367,6 @@ public ByteSizeValue getFreeBytesThresholdFloodStage() {
371367
return freeBytesThresholdFloodStage;
372368
}
373369

374-
public boolean isAutoReleaseIndexEnabled() {
375-
return autoReleaseIndexEnabled;
376-
}
377-
378370
public boolean includeRelocations() {
379371
return includeRelocations;
380372
}

server/src/test/java/org/opensearch/cluster/routing/allocation/DiskThresholdSettingsTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public void testDefaults() {
6060
assertTrue(diskThresholdSettings.includeRelocations());
6161
assertEquals(zeroBytes, diskThresholdSettings.getFreeBytesThresholdFloodStage());
6262
assertEquals(5.0D, diskThresholdSettings.getFreeDiskThresholdFloodStage(), 0.0D);
63-
assertTrue(diskThresholdSettings.isAutoReleaseIndexEnabled());
6463
}
6564

6665
public void testUpdate() {

0 commit comments

Comments
 (0)