From eb54352dca6fddb11f4278fa53b1fe26925b5620 Mon Sep 17 00:00:00 2001 From: pgomulka Date: Tue, 12 Oct 2021 15:09:09 +0200 Subject: [PATCH] Deprecation logs indexing is enabled by default Changing the default for deprecation log indexing to be true. This commit also overrides this defualt to tests where a deprecation data stream would intefere - because it uses index template, it would not be possible to delete with _index_template/*. The overrides should be removed when #78850 is done. closes #76292 --- client/rest-high-level/build.gradle | 1 + docs/build.gradle | 2 +- x-pack/docs/build.gradle | 1 + x-pack/plugin/build.gradle | 1 + x-pack/plugin/data-streams/qa/multi-node/build.gradle | 1 + x-pack/plugin/data-streams/qa/rest/build.gradle | 1 + .../elasticsearch/xpack/deprecation/DeprecationHttpIT.java | 7 ++----- .../org/elasticsearch/xpack/deprecation/Deprecation.java | 6 +++--- x-pack/plugin/ml/qa/basic-multi-node/build.gradle | 1 + x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle | 1 + .../xpack/monitoring/exporter/http/HttpExporterIT.java | 3 ++- .../xpack/monitoring/test/MonitoringIntegTestCase.java | 3 ++- .../watcher/test/AbstractWatcherIntegrationTestCase.java | 1 + x-pack/qa/core-rest-tests-with-security/build.gradle | 1 + 14 files changed, 19 insertions(+), 11 deletions(-) diff --git a/client/rest-high-level/build.gradle b/client/rest-high-level/build.gradle index d43cab006b724..4323de546c6d5 100644 --- a/client/rest-high-level/build.gradle +++ b/client/rest-high-level/build.gradle @@ -114,6 +114,7 @@ testClusters.configureEach { setting 'indices.lifecycle.poll_interval', '1000ms' setting 'indices.lifecycle.history_index_enabled', 'false' + setting 'cluster.deprecation_indexing.enabled', 'false' keystore 'xpack.security.transport.ssl.truststore.secure_password', 'testnode' extraConfigFile 'roles.yml', file('roles.yml') user username: clusterUserNameProvider.get(), diff --git a/docs/build.gradle b/docs/build.gradle index 5ecaf7dc6faff..229b4f0dd6a60 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -67,7 +67,7 @@ testClusters.matching { it.name == "integTest"}.configureEach { systemProperty 'es.geoip_v2_feature_flag_enabled', 'true' keystorePassword 'keystore-password' } - + setting 'cluster.deprecation_indexing.enabled', 'false' // enable regexes in painless so our tests don't complain about example snippets that use them setting 'script.painless.regex.enabled', 'true' setting 'xpack.security.enabled', 'false' diff --git a/x-pack/docs/build.gradle b/x-pack/docs/build.gradle index c2a4ea7402810..3621113a5b468 100644 --- a/x-pack/docs/build.gradle +++ b/x-pack/docs/build.gradle @@ -39,6 +39,7 @@ testClusters.matching { it.name == "integTest" }.configureEach { setting 'xpack.monitoring.exporters._local.enabled', 'false' // disable the ILM history for doc tests to avoid potential lingering tasks that'd cause test flakiness setting 'indices.lifecycle.history_index_enabled', 'false' + setting 'cluster.deprecation_indexing.enabled', 'false' setting 'xpack.license.self_generated.type', 'trial' setting 'xpack.security.authc.realms.file.file.order', '0' setting 'xpack.security.authc.realms.native.native.order', '1' diff --git a/x-pack/plugin/build.gradle b/x-pack/plugin/build.gradle index 7acd20167747d..d28d6e210b01b 100644 --- a/x-pack/plugin/build.gradle +++ b/x-pack/plugin/build.gradle @@ -193,6 +193,7 @@ testClusters.configureEach { setting 'xpack.license.self_generated.type', 'trial' // disable ILM history, since it disturbs tests using _all setting 'indices.lifecycle.history_index_enabled', 'false' + setting 'cluster.deprecation_indexing.enabled', 'false' keystore 'bootstrap.password', 'x-pack-test-password' keystore 'xpack.security.transport.ssl.secure_key_passphrase', 'testnode' setting 'xpack.searchable.snapshot.shared_cache.size', '10mb' diff --git a/x-pack/plugin/data-streams/qa/multi-node/build.gradle b/x-pack/plugin/data-streams/qa/multi-node/build.gradle index 0dfc36b3c8561..4c6271f1ea2df 100644 --- a/x-pack/plugin/data-streams/qa/multi-node/build.gradle +++ b/x-pack/plugin/data-streams/qa/multi-node/build.gradle @@ -20,6 +20,7 @@ testClusters.matching { it.name == "javaRestTest" }.configureEach { setting 'xpack.license.self_generated.type', 'trial' //disabling ILM history as it disturbs testDSXpackUsage test setting 'indices.lifecycle.history_index_enabled', 'false' + setting 'cluster.deprecation_indexing.enabled', 'false' } if (BuildParams.inFipsJvm){ diff --git a/x-pack/plugin/data-streams/qa/rest/build.gradle b/x-pack/plugin/data-streams/qa/rest/build.gradle index 80e3647638994..fb5bfe39998ee 100644 --- a/x-pack/plugin/data-streams/qa/rest/build.gradle +++ b/x-pack/plugin/data-streams/qa/rest/build.gradle @@ -20,6 +20,7 @@ testClusters.configureEach { setting 'xpack.license.self_generated.type', 'trial' // disable ILM history, since it disturbs tests using _all setting 'indices.lifecycle.history_index_enabled', 'false' + setting 'cluster.deprecation_indexing.enabled', 'false' setting 'xpack.security.enabled', 'false' if (BuildParams.isSnapshotBuild() == false) { systemProperty 'es.index_mode_feature_flag_registered', 'true' diff --git a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java b/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java index 2249f087b2bac..2e464b60baafd 100644 --- a/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java +++ b/x-pack/plugin/deprecation/qa/rest/src/javaRestTest/java/org/elasticsearch/xpack/deprecation/DeprecationHttpIT.java @@ -67,7 +67,6 @@ public class DeprecationHttpIT extends ESRestTestCase { @Before public void assertIndexingIsEnabled() throws Exception { - configureWriteDeprecationLogsToIndex(true); // make sure the deprecation logs indexing is enabled Response response = client().performRequest(new Request("GET", "/_cluster/settings?include_defaults=true&flat_settings=true")); @@ -75,8 +74,8 @@ public void assertIndexingIsEnabled() throws Exception { ObjectMapper mapper = new ObjectMapper(); final JsonNode jsonNode = mapper.readTree(response.getEntity().getContent()); - final boolean transientValue = jsonNode.at("/transient/cluster.deprecation_indexing.enabled").asBoolean(); - assertTrue(transientValue); + final boolean defaultValue = jsonNode.at("/defaults/cluster.deprecation_indexing.enabled").asBoolean(); + assertTrue(defaultValue); // assert index does not exist, which will prevent previous tests to interfere assertBusy(() -> { @@ -350,8 +349,6 @@ public void testDeprecationRouteThrottling() throws Exception { } public void testDisableDeprecationLogIndexing() throws Exception { - - configureWriteDeprecationLogsToIndex(true); final Request deprecatedRequest = deprecatedRequest("GET", "xOpaqueId-testDisableDeprecationLogIndexing"); assertOK(client().performRequest(deprecatedRequest)); configureWriteDeprecationLogsToIndex(false); diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/Deprecation.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/Deprecation.java index b89ebd71c9475..f0edba255993a 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/Deprecation.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/Deprecation.java @@ -48,7 +48,7 @@ public class Deprecation extends Plugin implements ActionPlugin { public static final Setting WRITE_DEPRECATION_LOGS_TO_INDEX = Setting.boolSetting( "cluster.deprecation_indexing.enabled", - false, + true, Setting.Property.NodeScope, Setting.Property.Dynamic ); @@ -98,12 +98,12 @@ public Collection createComponents( final RateLimitingFilter rateLimitingFilterForIndexing = new RateLimitingFilter(); // enable on start. - rateLimitingFilterForIndexing.setUseXOpaqueId(USE_X_OPAQUE_ID_IN_FILTERING.getDefault(environment.settings())); + rateLimitingFilterForIndexing.setUseXOpaqueId(USE_X_OPAQUE_ID_IN_FILTERING.get(environment.settings())); final DeprecationIndexingComponent component = new DeprecationIndexingComponent(client, environment.settings(), rateLimitingFilterForIndexing, - WRITE_DEPRECATION_LOGS_TO_INDEX.getDefault(environment.settings()) //pass the default on startup + WRITE_DEPRECATION_LOGS_TO_INDEX.get(environment.settings()) //pass the default on startup ); clusterService.getClusterSettings().addSettingsUpdateConsumer(USE_X_OPAQUE_ID_IN_FILTERING, diff --git a/x-pack/plugin/ml/qa/basic-multi-node/build.gradle b/x-pack/plugin/ml/qa/basic-multi-node/build.gradle index 2234f5e43d51c..827039cee92b3 100644 --- a/x-pack/plugin/ml/qa/basic-multi-node/build.gradle +++ b/x-pack/plugin/ml/qa/basic-multi-node/build.gradle @@ -11,6 +11,7 @@ testClusters.configureEach { setting 'xpack.ml.enabled', 'true' setting 'xpack.license.self_generated.type', 'trial' setting 'indices.lifecycle.history_index_enabled', 'false' + setting 'cluster.deprecation_indexing.enabled', 'false' setting 'slm.history_index_enabled', 'false' } diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle index 9ec7ee72f7848..4380d7126b442 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle @@ -52,6 +52,7 @@ testClusters.configureEach { setting 'xpack.license.self_generated.type', 'trial' setting 'xpack.ml.min_disk_space_off_heap', '200mb' setting 'indices.lifecycle.history_index_enabled', 'false' + setting 'cluster.deprecation_indexing.enabled', 'false' setting 'slm.history_index_enabled', 'false' setting 'stack.templates.enabled', 'false' // To spice things up a bit, one of the nodes is not an ML node diff --git a/x-pack/plugin/monitoring/src/internalClusterTest/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java b/x-pack/plugin/monitoring/src/internalClusterTest/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java index 151f106eca4fe..9d7d40d7e3fb8 100644 --- a/x-pack/plugin/monitoring/src/internalClusterTest/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java +++ b/x-pack/plugin/monitoring/src/internalClusterTest/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java @@ -110,7 +110,8 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) { .put(MonitoringService.INTERVAL.getKey(), MonitoringService.MIN_INTERVAL) // we do this by default in core, but for monitoring this isn't needed and only adds noise. .put("indices.lifecycle.history_index_enabled", false) - .put("index.store.mock.check_index_on_close", false); + .put("index.store.mock.check_index_on_close", false) + .put("cluster.deprecation_indexing.enabled", false); return builder.build(); } diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java index b50a269809f53..88aacdb2cd10a 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java @@ -54,7 +54,8 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) { // .put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false) // we do this by default in core, but for monitoring this isn't needed and only adds noise. .put("indices.lifecycle.history_index_enabled", false) - .put("index.store.mock.check_index_on_close", false); + .put("index.store.mock.check_index_on_close", false) + .put("cluster.deprecation_indexing.enabled", false); return builder.build(); } diff --git a/x-pack/plugin/watcher/src/internalClusterTest/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java b/x-pack/plugin/watcher/src/internalClusterTest/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java index 28eab3e26cf36..43a87ee4069d0 100644 --- a/x-pack/plugin/watcher/src/internalClusterTest/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java +++ b/x-pack/plugin/watcher/src/internalClusterTest/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java @@ -121,6 +121,7 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) { .put("xpack.watcher.execution.scroll.size", randomIntBetween(1, 100)) .put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100)) .put("indices.lifecycle.history_index_enabled", false) + .put("cluster.deprecation_indexing.enabled", false) .build(); } diff --git a/x-pack/qa/core-rest-tests-with-security/build.gradle b/x-pack/qa/core-rest-tests-with-security/build.gradle index e8fdffe47c01f..b0b0ef952780e 100644 --- a/x-pack/qa/core-rest-tests-with-security/build.gradle +++ b/x-pack/qa/core-rest-tests-with-security/build.gradle @@ -30,6 +30,7 @@ testClusters.matching { it.name == "integTest" }.configureEach { setting 'xpack.ml.enabled', 'false' setting 'xpack.license.self_generated.type', 'trial' setting 'indices.lifecycle.history_index_enabled', 'false' + setting 'cluster.deprecation_indexing.enabled', 'false' setting 'xpack.security.autoconfiguration.enabled', 'false' if (BuildParams.isSnapshotBuild() == false) { systemProperty 'es.index_mode_feature_flag_registered', 'true'