Skip to content

Commit 6e3a108

Browse files
authored
Reduce deprecation logging severity for settings that are not removed in 8.0 (#79665)
This commit lowers the severity for all settings from critical to warning for all settings that are still present in 8.0.0. releated #79107
1 parent f20a0dc commit 6e3a108

File tree

38 files changed

+209
-156
lines changed

38 files changed

+209
-156
lines changed

libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/SslConfigurationKeys.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class SslConfigurationKeys {
5757
public static final String TRUSTSTORE_SECURE_PASSWORD = "truststore.secure_password";
5858
/**
5959
* The password for the file configured in {@link #TRUSTSTORE_PATH}, as a non-secure setting.
60-
* The use of this setting {@link #isDeprecated(String) is deprecated}.
60+
* The use of this setting {@link #isDeprecatedWarning(String) is deprecated}.
6161
*/
6262
public static final String TRUSTSTORE_LEGACY_PASSWORD = "truststore.password";
6363
/**
@@ -82,7 +82,7 @@ public class SslConfigurationKeys {
8282
public static final String KEYSTORE_SECURE_PASSWORD = "keystore.secure_password";
8383
/**
8484
* The password for the file configured in {@link #KEYSTORE_PATH}, as a non-secure setting.
85-
* The use of this setting {@link #isDeprecated(String) is deprecated}.
85+
* The use of this setting {@link #isDeprecatedWarning(String) is deprecated}.
8686
*/
8787
public static final String KEYSTORE_LEGACY_PASSWORD = "keystore.password";
8888
/**
@@ -92,7 +92,7 @@ public class SslConfigurationKeys {
9292
public static final String KEYSTORE_SECURE_KEY_PASSWORD = "keystore.secure_key_password";
9393
/**
9494
* The password for the key within the {@link #KEYSTORE_PATH configured keystore}, as a non-secure setting.
95-
* The use of this setting {@link #isDeprecated(String) is deprecated}.
95+
* The use of this setting {@link #isDeprecatedWarning(String) is deprecated}.
9696
* If no key password is specified, it will default to the keystore password.
9797
*/
9898
public static final String KEYSTORE_LEGACY_KEY_PASSWORD = "keystore.key_password";
@@ -121,11 +121,14 @@ public class SslConfigurationKeys {
121121
public static final String KEY_SECURE_PASSPHRASE = "secure_key_passphrase";
122122
/**
123123
* The password to read the configured {@link #KEY}, as a non-secure setting.
124-
* The use of this setting {@link #isDeprecated(String) is deprecated}.
124+
* The use of this setting {@link #isDeprecatedWarning(String) is deprecated}.
125125
*/
126126
public static final String KEY_LEGACY_PASSPHRASE = "key_passphrase";
127127

128-
private static final Set<String> DEPRECATED_KEYS = new HashSet<>(
128+
/**
129+
* Warning severity deprecated keys
130+
*/
131+
private static final Set<String> DEPRECATED_WARNING_KEYS = new HashSet<>(
129132
Arrays.asList(TRUSTSTORE_LEGACY_PASSWORD, KEYSTORE_LEGACY_PASSWORD, KEYSTORE_LEGACY_KEY_PASSWORD, KEY_LEGACY_PASSPHRASE)
130133
);
131134

@@ -161,10 +164,10 @@ public static List<String> getSecureStringKeys() {
161164
}
162165

163166
/**
164-
* @return {@code true} if the provided key is a deprecated setting
167+
* @return {@code true} if the provided key is a deprecated setting at warning severity
165168
*/
166-
public static boolean isDeprecated(String key) {
167-
return DEPRECATED_KEYS.contains(key);
169+
public static boolean isDeprecatedWarning(String key) {
170+
return DEPRECATED_WARNING_KEYS.contains(key);
168171
}
169172

170173
}

modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexSslConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ public class ReindexSslConfig {
5050

5151
static {
5252
Setting.Property[] defaultProperties = new Setting.Property[] { Setting.Property.NodeScope, Setting.Property.Filtered };
53-
Setting.Property[] deprecatedProperties = new Setting.Property[] { Setting.Property.Deprecated, Setting.Property.NodeScope,
53+
Setting.Property[] deprecatedProperties = new Setting.Property[] { Setting.Property.DeprecatedWarning, Setting.Property.NodeScope,
5454
Setting.Property.Filtered };
5555
for (String key : SslConfigurationKeys.getStringKeys()) {
5656
String settingName = "reindex.ssl." + key;
57-
final Setting.Property[] properties = SslConfigurationKeys.isDeprecated(key) ? deprecatedProperties : defaultProperties;
57+
final Setting.Property[] properties = SslConfigurationKeys.isDeprecatedWarning(key) ? deprecatedProperties : defaultProperties;
5858
SETTINGS.put(settingName, simpleString(settingName, properties));
5959
}
6060
for (String key : SslConfigurationKeys.getListKeys()) {
6161
String settingName = "reindex.ssl." + key;
62-
final Setting.Property[] properties = SslConfigurationKeys.isDeprecated(key) ? deprecatedProperties : defaultProperties;
62+
final Setting.Property[] properties = SslConfigurationKeys.isDeprecatedWarning(key) ? deprecatedProperties : defaultProperties;
6363
SETTINGS.put(settingName, listSetting(settingName, Collections.emptyList(), Function.identity(), properties));
6464
}
6565
for (String key : SslConfigurationKeys.getSecureStringKeys()) {

server/src/main/java/org/elasticsearch/bootstrap/BootstrapSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private BootstrapSettings() {
2323
public static final Setting<Boolean> MEMORY_LOCK_SETTING =
2424
Setting.boolSetting("bootstrap.memory_lock", false, Property.NodeScope);
2525
public static final Setting<Boolean> SYSTEM_CALL_FILTER_SETTING =
26-
Setting.boolSetting("bootstrap.system_call_filter", true, Property.Deprecated, Property.NodeScope);
26+
Setting.boolSetting("bootstrap.system_call_filter", true, Property.DeprecatedWarning, Property.NodeScope);
2727
public static final Setting<Boolean> CTRLHANDLER_SETTING =
2828
Setting.boolSetting("bootstrap.ctrlhandler", true, Property.NodeScope);
2929

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public static APIBlock readFrom(StreamInput input) throws IOException {
287287
public static final String SETTING_HISTORY_UUID = "index.history.uuid";
288288
public static final String SETTING_DATA_PATH = "index.data_path";
289289
public static final Setting<String> INDEX_DATA_PATH_SETTING =
290-
new Setting<>(SETTING_DATA_PATH, "", Function.identity(), Property.IndexScope, Property.Deprecated);
290+
new Setting<>(SETTING_DATA_PATH, "", Function.identity(), Property.IndexScope, Property.DeprecatedWarning);
291291
public static final String INDEX_UUID_NA_VALUE = "_na_";
292292

293293
public static final String INDEX_ROUTING_REQUIRE_GROUP_PREFIX = "index.routing.allocation.require";

server/src/main/java/org/elasticsearch/common/settings/SecureSetting.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public abstract class SecureSetting<T> extends Setting<T> {
2626
/** Determines whether legacy settings with sensitive values should be allowed. */
2727
private static final boolean ALLOW_INSECURE_SETTINGS = Booleans.parseBoolean(System.getProperty("es.allow_insecure_settings", "false"));
2828

29-
private static final Set<Property> ALLOWED_PROPERTIES = EnumSet.of(Property.Deprecated, Property.Consistent);
29+
private static final Set<Property> ALLOWED_PROPERTIES = EnumSet.of(Property.Deprecated, Property.DeprecatedWarning,
30+
Property.Consistent);
3031

3132
private static final Property[] FIXED_PROPERTIES = {
3233
Property.NodeScope

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
221221
public static final Setting<Boolean> CACHE_REPOSITORY_DATA = Setting.boolSetting(
222222
"cache_repository_data",
223223
true,
224-
Setting.Property.Deprecated
224+
Setting.Property.DeprecatedWarning
225225
);
226226

227227
/**

server/src/test/java/org/elasticsearch/bootstrap/BootstrapChecksTests.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package org.elasticsearch.bootstrap;
1010

11+
import org.apache.logging.log4j.Level;
1112
import org.apache.logging.log4j.Logger;
1213
import org.apache.lucene.util.Constants;
1314
import org.elasticsearch.cluster.coordination.ClusterBootstrapService;
@@ -438,15 +439,15 @@ boolean isSystemCallFilterInstalled() {
438439
containsString("system call filters failed to install; " +
439440
"check the logs and fix your configuration or disable system call filters at your own risk"));
440441
if (useBootstrapSystemCallFilter) {
441-
assertWarnings("[bootstrap.system_call_filter] setting was deprecated in Elasticsearch " +
442+
assertWarnings(Level.WARN, "[bootstrap.system_call_filter] setting was deprecated in Elasticsearch " +
442443
"and will be removed in a future release!" +
443444
" See the breaking changes documentation for the next major version.");
444445
}
445446

446447
isSystemCallFilterInstalled.set(true);
447448
BootstrapChecks.check(context, true, Collections.singletonList(systemCallFilterEnabledCheck));
448449
if (useBootstrapSystemCallFilter) {
449-
assertWarnings("[bootstrap.system_call_filter] setting was deprecated in Elasticsearch " +
450+
assertWarnings(Level.WARN, "[bootstrap.system_call_filter] setting was deprecated in Elasticsearch " +
450451
"and will be removed in a future release!" +
451452
" See the breaking changes documentation for the next major version.");
452453
}
@@ -460,11 +461,13 @@ boolean isSystemCallFilterInstalled() {
460461
};
461462
isSystemCallFilterInstalled.set(false);
462463
BootstrapChecks.check(context_1, true, Collections.singletonList(systemCallFilterNotEnabledCheck));
463-
assertWarnings("[bootstrap.system_call_filter] setting was deprecated in Elasticsearch and will be removed in a future release!" +
464+
assertWarnings(Level.WARN, "[bootstrap.system_call_filter] setting was deprecated in Elasticsearch and will be removed in a " +
465+
"future release!" +
464466
" See the breaking changes documentation for the next major version.");
465467
isSystemCallFilterInstalled.set(true);
466468
BootstrapChecks.check(context_1, true, Collections.singletonList(systemCallFilterNotEnabledCheck));
467-
assertWarnings("[bootstrap.system_call_filter] setting was deprecated in Elasticsearch and will be removed in a future release!" +
469+
assertWarnings(Level.WARN, "[bootstrap.system_call_filter] setting was deprecated in Elasticsearch and will be removed in a " +
470+
"future release!" +
468471
" See the breaking changes documentation for the next major version.");
469472
}
470473

test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,15 @@ protected final void assertSettingDeprecationsAndWarnings(final Setting<?>[] set
468468
.toArray(DeprecationWarning[]::new));
469469
}
470470

471+
/**
472+
* Convenience method to assert warnings at a specific level for settings deprecations and general deprecation warnings.
473+
* @param expectedWarnings expected general deprecation warnings.
474+
*/
475+
protected final void assertWarnings(Level level, String... expectedWarnings) {
476+
assertWarnings(true, Arrays.stream(expectedWarnings).map(expectedWarning -> new DeprecationWarning(level,
477+
expectedWarning)).toArray(DeprecationWarning[]::new));
478+
}
479+
471480
/**
472481
* Convenience method to assert warnings for settings deprecations and general deprecation warnings. All warnings passed to this method
473482
* are assumed to be at DeprecationLogger.CRITICAL level.

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/StatsCollectorTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
package org.elasticsearch.xpack.monitoring.collector.ccr;
88

9+
import org.apache.logging.log4j.Level;
910
import org.elasticsearch.action.ActionFuture;
1011
import org.elasticsearch.client.Client;
1112
import org.elasticsearch.cluster.service.ClusterService;
@@ -150,8 +151,8 @@ public void testDoCollect() throws Exception {
150151
assertThat(document.getId(), nullValue());
151152
assertThat(document.stats(), is(autoFollowStats));
152153

153-
assertWarnings("[xpack.monitoring.collection.ccr.stats.timeout] setting was deprecated in Elasticsearch and will be removed in " +
154-
"a future release! See the breaking changes documentation for the next major version.");
154+
assertWarnings(Level.WARN, "[xpack.monitoring.collection.ccr.stats.timeout] setting was deprecated in Elasticsearch and will " +
155+
"be removed in a future release! See the breaking changes documentation for the next major version.");
155156
}
156157

157158
private List<FollowStatsAction.StatsResponse> mockStatuses() {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/LifecycleSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class LifecycleSettings {
4949
true, Setting.Property.NodeScope);
5050
public static final Setting<TimeValue> LIFECYCLE_STEP_MASTER_TIMEOUT_SETTING =
5151
Setting.positiveTimeSetting(LIFECYCLE_STEP_MASTER_TIMEOUT, TimeValue.timeValueSeconds(30), Setting.Property.Dynamic,
52-
Setting.Property.NodeScope, Setting.Property.Deprecated);
52+
Setting.Property.NodeScope, Setting.Property.DeprecatedWarning);
5353
// This setting configures how much time since step_time should ILM wait for a condition to be met. After the threshold wait time has
5454
// elapsed ILM will likely stop waiting and go to the next step.
5555
// Also see {@link org.elasticsearch.xpack.core.ilm.ClusterStateWaitUntilThresholdStep}

0 commit comments

Comments
 (0)