Skip to content

Commit ccbbd5b

Browse files
authored
Remove cluster setting validator for default rollover (#94447)
1 parent d535666 commit ccbbd5b

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

docs/changelog/94447.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 94447
2+
summary: Remove rollover cluster setting validator
3+
area: DLM
4+
type: bug
5+
issues: []

server/src/main/java/org/elasticsearch/cluster/metadata/DataLifecycle.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
import org.elasticsearch.xcontent.XContentParser;
2727

2828
import java.io.IOException;
29-
import java.util.ArrayList;
30-
import java.util.List;
3129
import java.util.Objects;
3230

3331
/**
@@ -39,32 +37,10 @@ public class DataLifecycle implements SimpleDiffable<DataLifecycle>, ToXContentO
3937
"cluster.dlm.default.rollover",
4038
"max_age=7d,max_primary_shard_size=50gb,min_docs=1,max_primary_shard_docs=200000000",
4139
(s) -> RolloverConditions.parseSetting(s, "cluster.dlm.default.rollover"),
42-
new RolloverConditionsValidator(),
4340
Setting.Property.Dynamic,
4441
Setting.Property.NodeScope
4542
);
4643

47-
/**
48-
* We require the default rollover conditions to have min_docs set to a non-negative number to avoid empty indices
49-
* and to have at least one MAX condition set to ensure that the rollover will be triggered.
50-
*/
51-
static class RolloverConditionsValidator implements Setting.Validator<RolloverConditions> {
52-
53-
@Override
54-
public void validate(RolloverConditions value) {
55-
List<String> errors = new ArrayList<>(2);
56-
if (value.getMinDocs() == null && value.getMinPrimaryShardDocs() == null) {
57-
errors.add("Either min_docs or min_primary_shard_docs rollover conditions should be set and greater than 0.");
58-
}
59-
if (value.hasMaxConditions() == false) {
60-
errors.add("At least one max_* rollover condition must be set.");
61-
}
62-
if (errors.isEmpty() == false) {
63-
throw new IllegalArgumentException(String.join(" ", errors));
64-
}
65-
}
66-
}
67-
6844
private static final FeatureFlag DLM_FEATURE_FLAG = new FeatureFlag("dlm");
6945

7046
public static final DataLifecycle EMPTY = new DataLifecycle();

server/src/test/java/org/elasticsearch/cluster/metadata/DataLifecycleTests.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,5 @@ public void testInvalidClusterSetting() {
9797
);
9898
assertThat(exception.getMessage(), equalTo("The rollover conditions cannot be null or blank"));
9999
}
100-
{
101-
IllegalArgumentException exception = expectThrows(
102-
IllegalArgumentException.class,
103-
() -> DataLifecycle.CLUSTER_DLM_DEFAULT_ROLLOVER_SETTING.get(
104-
Settings.builder().put(DataLifecycle.CLUSTER_DLM_DEFAULT_ROLLOVER_SETTING.getKey(), "min_docs=1").build()
105-
)
106-
);
107-
assertThat(exception.getMessage(), equalTo("At least one max_* rollover condition must be set."));
108-
}
109100
}
110101
}

0 commit comments

Comments
 (0)