Skip to content

Commit 3f02383

Browse files
committed
Validation
1 parent 892f575 commit 3f02383

File tree

1 file changed

+4
-0
lines changed
  • x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache

1 file changed

+4
-0
lines changed

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/FrozenCacheService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.elasticsearch.common.logging.DeprecationLogger;
2424
import org.elasticsearch.common.settings.Setting;
2525
import org.elasticsearch.common.settings.Settings;
26+
import org.elasticsearch.common.settings.SettingsException;
2627
import org.elasticsearch.common.transport.TransportAddress;
2728
import org.elasticsearch.common.unit.ByteSizeUnit;
2829
import org.elasticsearch.common.unit.ByteSizeValue;
@@ -92,6 +93,9 @@ public void validate(final ByteSizeValue value) {
9293

9394
@Override
9495
public void validate(final ByteSizeValue value, final Map<Setting<?>, Object> settings) {
96+
if (value.getBytes() == -1) {
97+
throw new SettingsException("setting [{}] must be non-negative", SHARED_CACHE_SETTINGS_PREFIX + "size");
98+
}
9599
if (value.getBytes() > 0) {
96100
@SuppressWarnings("unchecked") final List<DiscoveryNodeRole> roles =
97101
(List<DiscoveryNodeRole>) settings.get(NodeRoleSettings.NODE_ROLES_SETTING);

0 commit comments

Comments
 (0)