Skip to content

Commit

Permalink
Deprecation logs indexing is enabled by default (#78991)
Browse files Browse the repository at this point in the history
Changing the default for deprecation log indexing to be true.
This commit also overrides this default to tests where a deprecation
data stream would interfere - 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
  • Loading branch information
pgomulka authored Oct 13, 2021
1 parent b1e8e90 commit e287cd6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,12 @@ private void commonNodeConfig() {
for (ElasticsearchNode node : nodes) {
if (node.getTestDistribution().equals(TestDistribution.INTEG_TEST)) {
node.defaultConfig.put("xpack.security.enabled", "false");
} else {
if (node.getVersion().onOrAfter("8.0.0")) {
node.defaultConfig.put("cluster.deprecation_indexing.enabled", "false");
}
}

// Can only configure master nodes if we have node names defined
if (nodeNames != null) {
if (node.getVersion().onOrAfter("7.0.0")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public class ElasticsearchNode implements TestClusterConfiguration {
private static final TimeUnit ADDITIONAL_CONFIG_TIMEOUT_UNIT = TimeUnit.SECONDS;
private static final List<String> OVERRIDABLE_SETTINGS = Arrays.asList(
"path.repo",
"discovery.seed_providers"
"discovery.seed_providers",
"cluster.deprecation_indexing.enabled"

);

Expand Down
1 change: 1 addition & 0 deletions x-pack/plugin/deprecation/qa/rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ restResources {

testClusters.configureEach {
testDistribution = 'DEFAULT'
setting 'cluster.deprecation_indexing.enabled', 'true'
setting 'xpack.security.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,15 @@ 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"));
assertOK(response);
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(() -> {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class Deprecation extends Plugin implements ActionPlugin {

public static final Setting<Boolean> WRITE_DEPRECATION_LOGS_TO_INDEX = Setting.boolSetting(
"cluster.deprecation_indexing.enabled",
false,
true,
Setting.Property.NodeScope,
Setting.Property.Dynamic
);
Expand Down Expand Up @@ -98,12 +98,12 @@ public Collection<Object> 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,
Expand Down

0 comments on commit e287cd6

Please sign in to comment.