|
20 | 20 | import org.elasticsearch.common.settings.Setting;
|
21 | 21 | import org.elasticsearch.common.settings.Setting.Property;
|
22 | 22 | import org.elasticsearch.common.settings.Settings;
|
23 |
| -import org.elasticsearch.common.unit.ByteSizeValue; |
24 | 23 | import org.elasticsearch.common.ssl.SslConfigurationKeys;
|
| 24 | +import org.elasticsearch.common.unit.ByteSizeValue; |
25 | 25 | import org.elasticsearch.common.util.concurrent.EsExecutors;
|
26 | 26 | import org.elasticsearch.common.util.set.Sets;
|
27 | 27 | import org.elasticsearch.core.TimeValue;
|
|
36 | 36 | import org.elasticsearch.script.ScriptService;
|
37 | 37 | import org.elasticsearch.threadpool.FixedExecutorBuilder;
|
38 | 38 | import org.elasticsearch.transport.RemoteClusterService;
|
39 |
| -import org.elasticsearch.xpack.core.DataTier; |
40 | 39 | import org.elasticsearch.transport.SniffConnectionStrategy;
|
41 | 40 | import org.elasticsearch.transport.TransportService;
|
| 41 | +import org.elasticsearch.xpack.core.DataTier; |
42 | 42 | import org.elasticsearch.xpack.core.XPackSettings;
|
43 | 43 | import org.elasticsearch.xpack.core.security.SecurityField;
|
44 | 44 | import org.elasticsearch.xpack.core.security.authc.RealmConfig;
|
|
48 | 48 |
|
49 | 49 | import java.util.ArrayList;
|
50 | 50 | import java.util.Comparator;
|
| 51 | +import java.util.HashMap; |
51 | 52 | import java.util.HashSet;
|
52 | 53 | import java.util.List;
|
53 | 54 | import java.util.Locale;
|
@@ -671,6 +672,33 @@ static DeprecationIssue checkClusterRoutingAllocationIncludeRelocationsSetting(f
|
671 | 672 | );
|
672 | 673 | }
|
673 | 674 |
|
| 675 | + static DeprecationIssue checkFractionalByteValueSettings(final Settings settings, |
| 676 | + final PluginsAndModules pluginsAndModules, |
| 677 | + final ClusterState clusterState, |
| 678 | + final XPackLicenseState licenseState) { |
| 679 | + Map<String, String> fractionalByteSettings = new HashMap<>(); |
| 680 | + for (String key : settings.keySet()) { |
| 681 | + try { |
| 682 | + settings.getAsBytesSize(key, ByteSizeValue.ZERO); |
| 683 | + String stringValue = settings.get(key); |
| 684 | + if (stringValue.contains(".")) { |
| 685 | + fractionalByteSettings.put(key, stringValue); |
| 686 | + } |
| 687 | + } catch (Exception ignoreThis) { |
| 688 | + // We expect anything that is not a byte setting to throw an exception, but we don't care about those |
| 689 | + } |
| 690 | + } |
| 691 | + if (fractionalByteSettings.isEmpty()) { |
| 692 | + return null; |
| 693 | + } |
| 694 | + String url = "https://www.elastic.co/guide/en/elasticsearch/reference/master/logging.html#deprecation-logging"; |
| 695 | + String message = "support for fractional byte size values is deprecated and will be removed in a future release"; |
| 696 | + String details = "change the following settings to non-fractional values: [" + |
| 697 | + fractionalByteSettings.entrySet().stream().map(fractionalByteSetting -> fractionalByteSetting.getKey() + "->" + |
| 698 | + fractionalByteSetting.getValue()).collect(Collectors.joining(", ")) + "]"; |
| 699 | + return new DeprecationIssue(DeprecationIssue.Level.WARNING, message, url, details, false, null); |
| 700 | + } |
| 701 | + |
674 | 702 | static DeprecationIssue checkFrozenCacheLeniency(final Settings settings,
|
675 | 703 | final PluginsAndModules pluginsAndModules,
|
676 | 704 | final ClusterState clusterState,
|
|
0 commit comments