From 076a3873b023b1aa8185067efc493760841f2fb9 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Mon, 2 Aug 2021 17:28:35 +0200 Subject: [PATCH] Add resolve_during_rolling_upgrade field to deprecation issue (#75879) Backporting #74226 to 7.x branch. Add an additional boolean field to a deprecation issue to indicate that a deprecation issue can only be resolved during a rolling upgrade when a node is offline (for the upgrade). No deprecation issue has been marked as restart required as part of this change. Closes #73091 --- .../migration/DeprecationInfoResponse.java | 19 +++++++--- .../DeprecationInfoResponseTests.java | 2 ++ .../CcrAutoFollowedSystemIndicesChecker.java | 2 +- .../deprecation/ClusterDeprecationChecks.java | 10 +++--- .../deprecation/DeprecationInfoAction.java | 3 +- .../xpack/deprecation/DeprecationIssue.java | 20 +++++++++-- .../deprecation/IndexDeprecationChecks.java | 20 ++++++----- .../deprecation/MlDeprecationChecker.java | 5 +-- .../deprecation/NodeDeprecationChecks.java | 27 +++++++------- .../ClusterDeprecationChecksTests.java | 7 ++-- .../deprecation/DeprecationChecksTests.java | 3 +- .../DeprecationInfoActionResponseTests.java | 3 +- .../deprecation/DeprecationIssueTests.java | 10 +++--- .../IndexDeprecationChecksTests.java | 27 +++++++------- .../NodeDeprecationChecksTests.java | 35 ++++++++++--------- .../TransportDeprecationInfoActionTests.java | 15 ++++---- 16 files changed, 129 insertions(+), 79 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/DeprecationInfoResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/DeprecationInfoResponse.java index 32bf9c342951d..1548347eba8fc 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/DeprecationInfoResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/DeprecationInfoResponse.java @@ -128,6 +128,7 @@ public static class DeprecationIssue { private static final ParseField MESSAGE = new ParseField("message"); private static final ParseField URL = new ParseField("url"); private static final ParseField DETAILS = new ParseField("details"); + private static final ParseField RESOLVE_DURING_ROLLING_UPGRADE = new ParseField("resolve_during_rolling_upgrade"); private static final ParseField META = new ParseField("_meta"); static final ConstructingObjectParser PARSER = @@ -136,9 +137,10 @@ public static class DeprecationIssue { String message = (String) args[1]; String url = (String) args[2]; String details = (String) args[3]; + boolean resolveDuringRollingUpgrade = (boolean) args[4]; @SuppressWarnings("unchecked") - Map meta = (Map) args[4]; - return new DeprecationIssue(Level.fromString(logLevel), message, url, details, meta); + Map meta = (Map) args[5]; + return new DeprecationIssue(Level.fromString(logLevel), message, url, details, resolveDuringRollingUpgrade, meta); }); static { @@ -146,6 +148,7 @@ public static class DeprecationIssue { PARSER.declareString(ConstructingObjectParser.constructorArg(), MESSAGE); PARSER.declareString(ConstructingObjectParser.constructorArg(), URL); PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), DETAILS); + PARSER.declareBoolean(ConstructingObjectParser.constructorArg(), RESOLVE_DURING_ROLLING_UPGRADE); PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), (p, c) -> p.map(), META); } @@ -168,13 +171,16 @@ public String toString() { private final String message; private final String url; private final String details; + private final boolean resolveDuringRollingUpgrade; private final Map meta; - public DeprecationIssue(Level level, String message, String url, @Nullable String details, @Nullable Map meta) { + public DeprecationIssue(Level level, String message, String url, @Nullable String details, boolean resolveDuringRollingUpgrade, + @Nullable Map meta) { this.level = level; this.message = message; this.url = url; this.details = details; + this.resolveDuringRollingUpgrade = resolveDuringRollingUpgrade; this.meta = meta; } @@ -194,6 +200,10 @@ public String getDetails() { return details; } + public boolean isResolveDuringRollingUpgrade() { + return resolveDuringRollingUpgrade; + } + public Map getMeta() { return meta; } @@ -211,12 +221,13 @@ public boolean equals(Object o) { Objects.equals(message, that.message) && Objects.equals(url, that.url) && Objects.equals(details, that.details) && + Objects.equals(resolveDuringRollingUpgrade, that.resolveDuringRollingUpgrade) && Objects.equals(meta, that.meta); } @Override public int hashCode() { - return Objects.hash(level, message, url, details, meta); + return Objects.hash(level, message, url, details, resolveDuringRollingUpgrade, meta); } } } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/migration/DeprecationInfoResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/migration/DeprecationInfoResponseTests.java index cb2564731c749..40c8d0552c884 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/migration/DeprecationInfoResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/migration/DeprecationInfoResponseTests.java @@ -73,6 +73,7 @@ private void toXContent(DeprecationInfoResponse.DeprecationIssue issue, XContent if (issue.getDetails() != null) { builder.field("details", issue.getDetails()); } + builder.field("resolve_during_rolling_upgrade", issue.isResolveDuringRollingUpgrade()); if (issue.getMeta() != null) { builder.field("_meta", issue.getMeta()); } @@ -99,6 +100,7 @@ private List createRandomIssues(boolea randomAlphaOfLength(5), randomAlphaOfLength(5), randomBoolean() ? randomAlphaOfLength(5) : null, + randomBoolean(), randomBoolean() ? randomMap(1, 5, () -> new Tuple<>(randomAlphaOfLength(4), randomAlphaOfLength(4))) : null)); } return list; diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/CcrAutoFollowedSystemIndicesChecker.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/CcrAutoFollowedSystemIndicesChecker.java index 20c5f75b403a1..717051d9b206f 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/CcrAutoFollowedSystemIndicesChecker.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/CcrAutoFollowedSystemIndicesChecker.java @@ -42,7 +42,7 @@ private DeprecationIssue createDeprecationIssue(String localIndexName) { "https://www.elastic.co/guide/en/elasticsearch/reference/7.13/migrating-7.14.html#breaking_714_ccr_changes", "Auto followed index [" + localIndexName + "] follows a remote system index and this behaviour will change in the next major version.", - null + false, null ); } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecks.java index 1ec609726ce9a..84910d26ef5ce 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecks.java @@ -64,7 +64,7 @@ static DeprecationIssue checkUserAgentPipelines(ClusterState state) { "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html" + "#ingest-user-agent-ecs-always", "Ingest pipelines " + pipelinesWithDeprecatedEcsConfig + - " uses the [ecs] option which needs to be removed to work in 8.0", null); + " uses the [ecs] option which needs to be removed to work in 8.0", false, null); } return null; } @@ -95,7 +95,7 @@ static DeprecationIssue checkTemplatesWithTooManyFields(ClusterState state) { "Index templates " + templatesOverLimit + " have a number of fields which exceeds the automatic field expansion " + "limit of [" + maxClauseCount + "] and does not have [" + IndexSettings.DEFAULT_FIELD_SETTING.getKey() + "] set, " + "which may cause queries which use automatic field expansion, such as query_string, simple_query_string, and " + - "multi_match to fail if fields are not explicitly specified in the query.", null); + "multi_match to fail if fields are not explicitly specified in the query.", false, null); } return null; } @@ -129,7 +129,8 @@ static DeprecationIssue checkTemplatesWithFieldNamesDisabled(ClusterState state) "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html#fieldnames-enabling", "Index templates " + templatesContainingFieldNames + " use the deprecated `enable` setting for the `" + FieldNamesFieldMapper.NAME + "` field. Using this setting in new index mappings will throw an error " - + "in the next major version and needs to be removed from existing mappings and templates.", null); + + "in the next major version and needs to be removed from existing mappings and templates.", + false, null); } return null; } @@ -167,7 +168,7 @@ static DeprecationIssue checkPollIntervalTooLow(ClusterState state) { "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html" + "#ilm-poll-interval-limit", "The Index Lifecycle Management poll interval setting [" + LIFECYCLE_POLL_INTERVAL_SETTING.getKey() + "] is " + - "currently set to [" + pollIntervalString + "], but must be 1s or greater", null); + "currently set to [" + pollIntervalString + "], but must be 1s or greater", false, null); } return null; } @@ -189,6 +190,7 @@ static DeprecationIssue checkTemplatesWithMultipleTypes(ClusterState state) { "https://www.elastic.co/guide/en/elasticsearch/reference/master/removal-of-types.html", "Index templates " + templatesWithMultipleTypes + " define multiple types and so will cause errors when used in index creation", + false, null); } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java index 6f4bed3a2b3e0..8f466bd95d0f5 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationInfoAction.java @@ -73,7 +73,8 @@ private static List mergeNodeIssues(NodesDeprecationCheckRespo DeprecationIssue issue = entry.getKey(); String details = issue.getDetails() != null ? issue.getDetails() + " " : ""; return new DeprecationIssue(issue.getLevel(), issue.getMessage(), issue.getUrl(), - details + "(nodes impacted: " + entry.getValue() + ")", issue.getMeta()); + details + "(nodes impacted: " + entry.getValue() + ")", issue.isResolveDuringRollingUpgrade(), + issue.getMeta()); }).collect(Collectors.toList()); } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationIssue.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationIssue.java index e37238c5f3e0a..fa8db3ebe553e 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationIssue.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationIssue.java @@ -64,13 +64,16 @@ public String toString() { private final String message; private final String url; private final String details; + private final boolean resolveDuringRollingUpgrade; private final Map meta; - public DeprecationIssue(Level level, String message, String url, @Nullable String details, @Nullable Map meta) { + public DeprecationIssue(Level level, String message, String url, @Nullable String details, boolean resolveDuringRollingUpgrade, + @Nullable Map meta) { this.level = level; this.message = message; this.url = url; this.details = details; + this.resolveDuringRollingUpgrade = resolveDuringRollingUpgrade; this.meta = meta; } @@ -79,6 +82,7 @@ public DeprecationIssue(StreamInput in) throws IOException { message = in.readString(); url = in.readString(); details = in.readOptionalString(); + resolveDuringRollingUpgrade = in.getVersion().onOrAfter(Version.V_7_15_0) && in.readBoolean(); meta = in.getVersion().onOrAfter(Version.V_7_14_0) ? in.readMap() : null; } @@ -98,6 +102,13 @@ public String getDetails() { return details; } + /** + * @return whether a deprecation issue can only be resolved during a rolling upgrade when a node is offline. + */ + public boolean isResolveDuringRollingUpgrade() { + return resolveDuringRollingUpgrade; + } + /** * @return custom metadata, which allows the ui to display additional details * without parsing the deprecation message itself. @@ -112,6 +123,9 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(message); out.writeString(url); out.writeOptionalString(details); + if (out.getVersion().onOrAfter(Version.V_7_15_0)) { + out.writeBoolean(resolveDuringRollingUpgrade); + } if (out.getVersion().onOrAfter(Version.V_7_14_0)) { out.writeMap(meta); } @@ -126,6 +140,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (details != null) { builder.field("details", details); } + builder.field("resolve_during_rolling_upgrade", resolveDuringRollingUpgrade); if (meta != null) { builder.field("_meta", meta); } @@ -145,12 +160,13 @@ public boolean equals(Object o) { Objects.equals(message, that.message) && Objects.equals(url, that.url) && Objects.equals(details, that.details) && + Objects.equals(resolveDuringRollingUpgrade, that.resolveDuringRollingUpgrade) && Objects.equals(meta, that.meta); } @Override public int hashCode() { - return Objects.hash(level, message, url, details, meta); + return Objects.hash(level, message, url, details, resolveDuringRollingUpgrade, meta); } @Override diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java index 685854e796087..37ffde62a06f6 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java @@ -107,7 +107,8 @@ static DeprecationIssue oldIndicesCheck(IndexMetadata indexMetadata) { "Index created before 7.0", "https://www.elastic.co/guide/en/elasticsearch/reference/master/" + "breaking-changes-8.0.html", - "This index was created using version: " + createdWith, null); + "This index was created using version: " + createdWith, + false, null); } return null; } @@ -131,7 +132,7 @@ static DeprecationIssue tooManyFieldsCheck(IndexMetadata indexMetadata) { "This index has [" + fieldCount.get() + "] fields, which exceeds the automatic field expansion limit of 1024 " + "and does not have [" + IndexSettings.DEFAULT_FIELD_SETTING.getKey() + "] set, which may cause queries which use " + "automatic field expansion, such as query_string, simple_query_string, and multi_match to fail if fields are not " + - "explicitly specified in the query.", null); + "explicitly specified in the query.", false, null); } } return null; @@ -152,7 +153,7 @@ static DeprecationIssue deprecatedDateTimeFormat(IndexMetadata indexMetadata) { "Date field format uses patterns which has changed meaning in 7.0", "https://www.elastic.co/guide/en/elasticsearch/reference/7.0/breaking-changes-7.0.html#breaking_70_java_time_changes", "This index has date fields with deprecated formats: " + fields + ". " - + JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, null); + + JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, false, null); } } return null; @@ -174,7 +175,7 @@ static DeprecationIssue chainedMultiFieldsCheck(IndexMetadata indexMetadata) { "Multi-fields within multi-fields", "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html" + "#_defining_multi_fields_within_multi_fields", - "The names of fields that contain chained multi-fields: " + issues, null); + "The names of fields that contain chained multi-fields: " + issues, false, null); } return null; } @@ -203,7 +204,7 @@ static DeprecationIssue fieldNamesDisabledCheck(IndexMetadata indexMetadata) { "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html" + "#fieldnames-enabling", "The index mapping contains a deprecated `enabled` setting for `_field_names` that should be removed moving foward.", - null); + false, null); } return null; } @@ -264,7 +265,8 @@ static DeprecationIssue translogRetentionSettingCheck(IndexMetadata indexMetadat "translog retention settings are ignored", "https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-translog.html", "translog retention settings [index.translog.retention.size] and [index.translog.retention.age] are ignored " + - "because translog is no longer used in peer recoveries with soft-deletes enabled (default in 7.0 or later)", null); + "because translog is no longer used in peer recoveries with soft-deletes enabled (default in 7.0 or later)", + false, null); } } return null; @@ -277,7 +279,7 @@ static DeprecationIssue checkIndexDataPath(IndexMetadata indexMetadata) { final String url = "https://www.elastic.co/guide/en/elasticsearch/reference/7.13/" + "breaking-changes-7.13.html#deprecate-shared-data-path-setting"; final String details = "Found index data path configured. Discontinue use of this setting."; - return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, null); + return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null); } return null; } @@ -298,7 +300,7 @@ private static DeprecationIssue slowLogSettingCheck(IndexMetadata indexMetadata, final String details = String.format(Locale.ROOT, "Found [%s] configured. Discontinue use of this setting. Use thresholds.", setting.getKey()); - return new DeprecationIssue(DeprecationIssue.Level.WARNING, message, url, details, null); + return new DeprecationIssue(DeprecationIssue.Level.WARNING, message, url, details, false, null); } return null; } @@ -311,7 +313,7 @@ static DeprecationIssue storeTypeSettingCheck(IndexMetadata indexMetadata) { "https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-store.html", "[simplefs] is deprecated and will be removed in 8.0. Use [niofs] or other file systems instead. " + "Elasticsearch 7.15 or later uses [niofs] for the [simplefs] store type " + - "as it offers superior or equivalent performance to [simplefs].", null); + "as it offers superior or equivalent performance to [simplefs].", false, null); } return null; } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecker.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecker.java index 004ecc2eb2951..1a2ba07c31243 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecker.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecker.java @@ -36,7 +36,7 @@ static Optional checkDataFeedQuery(DatafeedConfig datafeedConf return Optional.of(new DeprecationIssue(DeprecationIssue.Level.WARNING, "Datafeed [" + datafeedConfig.getId() + "] uses deprecated query options", "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html#breaking_70_search_changes", - deprecations.toString(), null)); + deprecations.toString(), false, null)); } } @@ -48,7 +48,7 @@ static Optional checkDataFeedAggregations(DatafeedConfig dataf return Optional.of(new DeprecationIssue(DeprecationIssue.Level.WARNING, "Datafeed [" + datafeedConfig.getId() + "] uses deprecated aggregation options", "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html" + - "#breaking_70_aggregations_changes", deprecations.toString(), null)); + "#breaking_70_aggregations_changes", deprecations.toString(), false, null)); } } @@ -77,6 +77,7 @@ static Optional checkModelSnapshot(ModelSnapshot modelSnapshot ), "https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-upgrade-job-model-snapshot.html", details.toString(), + false, Map.of("job_id", modelSnapshot.getJobId(), "snapshot_id", modelSnapshot.getSnapshotId())) ); } diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java index 20f112a267646..4968eea4ed60f 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java @@ -94,6 +94,7 @@ static DeprecationIssue checkMissingRealmOrders(final Settings settings, final P "Realm order will be required in next major release.", "https://www.elastic.co/guide/en/elasticsearch/reference/7.7/breaking-changes-7.7.html#deprecate-missing-realm-order", details, + false, null ); } @@ -129,7 +130,7 @@ static DeprecationIssue checkUniqueRealmOrders(final Settings settings, final Pl "Realm orders must be unique in next major release.", "https://www.elastic.co/guide/en/elasticsearch/reference/7.7/breaking-changes-7.7.html#deprecate-duplicated-realm-orders", details, - null + false, null ); } @@ -151,7 +152,7 @@ static DeprecationIssue checkImplicitlyDisabledSecurityOnBasicAndTrial(final Set "Security is enabled by default for all licenses in the next major version.", "https://www.elastic.co/guide/en/elasticsearch/reference/7.14/migrating-7.14.html#implicitly-disabled-security", details, - null); + false, null); } return null; } @@ -204,6 +205,7 @@ static DeprecationIssue checkImplicitlyDisabledBasicRealms(final Settings settin "File and/or native realms are enabled by default in next major release.", "https://www.elastic.co/guide/en/elasticsearch/reference/7.13/deprecated-7.13.html#implicitly-disabled-basic-realms", details, + false, null ); @@ -236,7 +238,7 @@ static DeprecationIssue checkReservedPrefixedRealmNames(final Settings settings, .map(rid -> RealmSettings.PREFIX + rid.getType() + "." + rid.getName()) .sorted() .collect(Collectors.joining("; "))), - null + false, null ); } } @@ -395,7 +397,7 @@ private static DeprecationIssue checkDeprecatedSetting( value, replacementSettingKey, replacementValue.apply(value, settings)); - return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, null); + return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null); } private static DeprecationIssue checkDeprecatedSetting( @@ -438,7 +440,7 @@ private static DeprecationIssue checkDeprecatedSetting( replacementSettingKey, replacementValue.apply(value, settings), star); - return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, null); + return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null); } static DeprecationIssue checkRemovedSetting(final Settings settings, final Setting removedSetting, final String url) { @@ -458,7 +460,7 @@ static DeprecationIssue checkRemovedSetting(final Settings settings, String.format(Locale.ROOT, "setting [%s] is deprecated and will be removed in the next major version", removedSettingKey); final String details = String.format(Locale.ROOT, "the setting [%s] is currently set to [%s], remove this setting", removedSettingKey, value); - return new DeprecationIssue(deprecationLevel, message, url, details, null); + return new DeprecationIssue(deprecationLevel, message, url, details, false, null); } static DeprecationIssue javaVersionCheck(Settings nodeSettings, PluginsAndModules plugins, final ClusterState clusterState, @@ -472,7 +474,7 @@ static DeprecationIssue javaVersionCheck(Settings nodeSettings, PluginsAndModule "Java 11 will be required for future versions of Elasticsearch, this node is running version [" + javaVersion.toString() + "]. Consider switching to a distribution of Elasticsearch with a bundled JDK. " + "If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.", - null); + false, null); } return null; } @@ -485,7 +487,7 @@ static DeprecationIssue checkMultipleDataPaths(Settings nodeSettings, PluginsAnd "multiple [path.data] entries are deprecated, use a single data directory", "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html#breaking_80_packaging_changes", "Multiple data paths are deprecated. Instead, use RAID or other system level features to utilize multiple disks.", - null); + false, null); } return null; } @@ -496,7 +498,7 @@ static DeprecationIssue checkDataPathsList(Settings nodeSettings, PluginsAndModu return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, "[path.data] in a list is deprecated, use a string value", "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html#breaking_80_packaging_changes", - "Configuring [path.data] with a list is deprecated. Instead specify as a string value.", null); + "Configuring [path.data] with a list is deprecated. Instead specify as a string value.", false, null); } return null; } @@ -509,7 +511,7 @@ static DeprecationIssue checkSharedDataPathSetting(final Settings settings, fina final String url = "https://www.elastic.co/guide/en/elasticsearch/reference/7.13/" + "breaking-changes-7.13.html#deprecate-shared-data-path-setting"; final String details = "Found shared data path configured. Discontinue use of this setting."; - return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, null); + return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null); } return null; } @@ -524,7 +526,7 @@ static DeprecationIssue checkSingleDataNodeWatermarkSetting(final Settings setti "https://www.elastic.co/guide/en/elasticsearch/reference/7.14/" + "breaking-changes-7.14.html#deprecate-single-data-node-watermark", String.format(Locale.ROOT, "found [%s] configured to false. Discontinue use of this setting or set it to true.", key), - null + false, null ); } @@ -541,6 +543,7 @@ static DeprecationIssue checkSingleDataNodeWatermarkSetting(final Settings setti " Set it to true to avoid this warning." + " Consider using [%s] to disable disk based allocation", key, disableDiskDecider), + false, null ); @@ -579,7 +582,7 @@ static DeprecationIssue checkMonitoringExporterPassword( passwordSettings ); final String url = "https://www.elastic.co/guide/en/elasticsearch/reference/7.7/monitoring-settings.html#http-exporter-settings"; - return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, null); + return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null); } static DeprecationIssue checkClusterRoutingAllocationIncludeRelocationsSetting(final Settings settings, diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecksTests.java index e98b9df6c9f28..8063b4f9853a3 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/ClusterDeprecationChecksTests.java @@ -87,7 +87,7 @@ public void testUserAgentEcsCheck() { "User-Agent ingest plugin will always use ECS-formatted output", "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html" + "#ingest-user-agent-ecs-always", - "Ingest pipelines [ecs_false, ecs_true] uses the [ecs] option which needs to be removed to work in 8.0", null); + "Ingest pipelines [ecs_false, ecs_true] uses the [ecs] option which needs to be removed to work in 8.0", false, null); assertEquals(singletonList(expected), issues); } @@ -159,7 +159,7 @@ public void testTemplateWithTooManyFields() throws IOException { "Index templates " + Collections.singletonList(tooManyFieldsTemplate) + " have a number of fields which exceeds the " + "automatic field expansion limit of [1024] and does not have [" + IndexSettings.DEFAULT_FIELD_SETTING.getKey() + "] set, " + "which may cause queries which use automatic field expansion, such as query_string, simple_query_string, and multi_match " + - "to fail if fields are not explicitly specified in the query.", null); + "to fail if fields are not explicitly specified in the query.", false, null); assertEquals(singletonList(expected), issues); } @@ -258,7 +258,7 @@ public void testPollIntervalTooLow() { "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html" + "#ilm-poll-interval-limit", "The Index Lifecycle Management poll interval setting [" + LIFECYCLE_POLL_INTERVAL_SETTING.getKey() + "] is " + - "currently set to [" + tooLowInterval + "], but must be 1s or greater", null); + "currently set to [" + tooLowInterval + "], but must be 1s or greater", false, null); List issues = DeprecationChecks.filterChecks(CLUSTER_SETTINGS_CHECKS, c -> c.apply(badState)); assertEquals(singletonList(expected), issues); } @@ -340,6 +340,7 @@ public void testClusterRoutingAllocationIncludeRelocationsSetting() { "the setting [%s] is currently set to [%b], remove this setting", settingKey, settingValue), + false, null ); diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationChecksTests.java index 41409f7c646bf..4a3c60ac5062c 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationChecksTests.java @@ -36,6 +36,7 @@ public void testFilterChecks() { private static DeprecationIssue createRandomDeprecationIssue() { String details = randomBoolean() ? randomAlphaOfLength(10) : null; return new DeprecationIssue(randomFrom(DeprecationIssue.Level.values()), randomAlphaOfLength(10), - randomAlphaOfLength(10), details, randomMap(1, 5, () -> Tuple.tuple(randomAlphaOfLength(4), randomAlphaOfLength(4)))); + randomAlphaOfLength(10), details, randomBoolean(), + randomMap(1, 5, () -> Tuple.tuple(randomAlphaOfLength(4), randomAlphaOfLength(4)))); } } diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationInfoActionResponseTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationInfoActionResponseTests.java index ee83d51cc7c9f..4810264b14182 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationInfoActionResponseTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationInfoActionResponseTests.java @@ -123,7 +123,8 @@ public void testFrom() throws IOException { if (nodeIssueFound) { String details = foundIssue.getDetails() != null ? foundIssue.getDetails() + " " : ""; DeprecationIssue mergedFoundIssue = new DeprecationIssue(foundIssue.getLevel(), foundIssue.getMessage(), foundIssue.getUrl(), - details + "(nodes impacted: [" + discoveryNode.getName() + "])", foundIssue.getMeta()); + details + "(nodes impacted: [" + discoveryNode.getName() + "])", foundIssue.isResolveDuringRollingUpgrade(), + foundIssue.getMeta()); assertThat(response.getNodeSettingsIssues(), equalTo(Collections.singletonList(mergedFoundIssue))); } else { assertTrue(response.getNodeSettingsIssues().isEmpty()); diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationIssueTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationIssueTests.java index 3e792803c6728..290522c646d1d 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationIssueTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationIssueTests.java @@ -30,7 +30,8 @@ public class DeprecationIssueTests extends ESTestCase { static DeprecationIssue createTestInstance() { String details = randomBoolean() ? randomAlphaOfLength(10) : null; return new DeprecationIssue(randomFrom(Level.values()), randomAlphaOfLength(10), - randomAlphaOfLength(10), details, randomMap(1, 5, () -> Tuple.tuple(randomAlphaOfLength(4), randomAlphaOfLength(4)))); + randomAlphaOfLength(10), details, randomBoolean(), + randomMap(1, 5, () -> Tuple.tuple(randomAlphaOfLength(4), randomAlphaOfLength(4)))); } @Before @@ -39,8 +40,8 @@ public void setup() { } public void testEqualsAndHashCode() { - DeprecationIssue other = - new DeprecationIssue(issue.getLevel(), issue.getMessage(), issue.getUrl(), issue.getDetails(), issue.getMeta()); + DeprecationIssue other = new DeprecationIssue(issue.getLevel(), issue.getMessage(), issue.getUrl(), issue.getDetails(), + issue.isResolveDuringRollingUpgrade(), issue.getMeta()); assertThat(issue, equalTo(other)); assertThat(other, equalTo(issue)); assertThat(issue.hashCode(), equalTo(other.hashCode())); @@ -65,9 +66,10 @@ public void testToXContent() throws IOException { assertTrue(toXContentMap.containsKey("details")); } String details = (String) toXContentMap.get("details"); + boolean requiresRestart = (boolean) toXContentMap.get("resolve_during_rolling_upgrade"); @SuppressWarnings("unchecked") Map meta = (Map) toXContentMap.get("_meta"); - DeprecationIssue other = new DeprecationIssue(Level.fromString(level), message, url, details, meta); + DeprecationIssue other = new DeprecationIssue(Level.fromString(level), message, url, details, requiresRestart, meta); assertThat(issue, equalTo(other)); } } diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java index e33a9050191bf..205a4a6142da5 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java @@ -50,7 +50,7 @@ public void testOldIndicesCheck() { "Index created before 7.0", "https://www.elastic.co/guide/en/elasticsearch/reference/master/" + "breaking-changes-8.0.html", - "This index was created using version: " + createdWith, null); + "This index was created using version: " + createdWith, false, null); List issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(indexMetadata)); assertEquals(singletonList(expected), issues); } @@ -106,7 +106,7 @@ public void testTooManyFieldsCheck() throws IOException { "This index has [" + fieldCount + "] fields, which exceeds the automatic field expansion limit of 1024 " + "and does not have [" + IndexSettings.DEFAULT_FIELD_SETTING.getKey() + "] set, which may cause queries which use " + "automatic field expansion, such as query_string, simple_query_string, and multi_match to fail if fields are not " + - "explicitly specified in the query.", null); + "explicitly specified in the query.", false, null); List issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(tooManyFieldsIndex)); assertEquals(singletonList(expected), issues); @@ -164,7 +164,7 @@ public void testChainedMultiFields() throws IOException { "Multi-fields within multi-fields", "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html" + "#_defining_multi_fields_within_multi_fields", - "The names of fields that contain chained multi-fields: [[type: _doc, field: invalid-field]]", null); + "The names of fields that contain chained multi-fields: [[type: _doc, field: invalid-field]]", false, null); assertEquals(singletonList(expected), issues); } @@ -217,7 +217,7 @@ public void testMultipleWarningsOnCombinedPattern() throws IOException { "suggestion: 'C' century of era is no longer supported." + "; "+ "'Y' year-of-era should be replaced with 'y'. Use 'Y' for week-based-year.]"+ - "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, null); + "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, false, null); List issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(simpleIndex)); assertThat(issues, hasItem(expected)); } @@ -239,7 +239,7 @@ public void testDuplicateWarningsOnCombinedPattern() throws IOException { "This index has date fields with deprecated formats: ["+ "[type: _doc, field: date_time_field_Y, format: dd-YYYY||MM-YYYY, " + "suggestion: 'Y' year-of-era should be replaced with 'y'. Use 'Y' for week-based-year.]"+ - "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, null); + "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, false, null); List issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(simpleIndex)); assertThat(issues, hasItem(expected)); } @@ -261,7 +261,7 @@ public void testWarningsOnMixCustomAndDefinedPattern() throws IOException { "This index has date fields with deprecated formats: ["+ "[type: _doc, field: date_time_field_Y, format: strictWeekyearWeek||MM-YYYY, " + "suggestion: 'Y' year-of-era should be replaced with 'y'. Use 'Y' for week-based-year.]"+ - "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, null); + "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, false, null); List issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(simpleIndex)); assertThat(issues, hasItem(expected)); } @@ -315,7 +315,7 @@ public void testJodaPatternDeprecations() throws IOException { "[type: _doc, field: date_time_field_z, format: HH:mmz, " + "suggestion: 'z' time zone text. Will print 'Z' for Zulu given UTC timezone." + "]"+ - "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, null); + "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, false, null); List issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(simpleIndex)); assertThat(issues, hasItem(expected)); } @@ -342,7 +342,7 @@ public void testMultipleJodaPatternDeprecationInOneField() throws IOException { "'C' century of era is no longer supported.; " + "'x' weak-year should be replaced with 'Y'. Use 'x' for zone-offset." + "]"+ - "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, null); + "]. "+ JodaDeprecationPatterns.USE_NEW_FORMAT_SPECIFIERS, false, null); List issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(simpleIndex)); assertThat(issues, hasItem(expected)); } @@ -404,7 +404,8 @@ public void testTranslogRetentionSettings() { "translog retention settings are ignored", "https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-translog.html", "translog retention settings [index.translog.retention.size] and [index.translog.retention.age] are ignored " + - "because translog is no longer used in peer recoveries with soft-deletes enabled (default in 7.0 or later)", null) + "because translog is no longer used in peer recoveries with soft-deletes enabled (default in 7.0 or later)", + false, null) )); } @@ -458,7 +459,7 @@ public void testIndexDataPathSetting() { "setting [index.data_path] is deprecated and will be removed in a future version", expectedUrl, "Found index data path configured. Discontinue use of this setting.", - null))); + false, null))); } public void testSlowLogLevel() { @@ -473,12 +474,12 @@ public void testSlowLogLevel() { new DeprecationIssue(DeprecationIssue.Level.WARNING, "setting [index.search.slowlog.level] is deprecated and will be removed in a future version", expectedUrl, - "Found [index.search.slowlog.level] configured. Discontinue use of this setting. Use thresholds.", null + "Found [index.search.slowlog.level] configured. Discontinue use of this setting. Use thresholds.", false, null ), new DeprecationIssue(DeprecationIssue.Level.WARNING, "setting [index.indexing.slowlog.level] is deprecated and will be removed in a future version", expectedUrl, - "Found [index.indexing.slowlog.level] configured. Discontinue use of this setting. Use thresholds.", null + "Found [index.indexing.slowlog.level] configured. Discontinue use of this setting. Use thresholds.", false, null ))); } @@ -493,7 +494,7 @@ public void testSimpleFSSetting() { "https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-store.html", "[simplefs] is deprecated and will be removed in 8.0. Use [niofs] or other file systems instead. " + "Elasticsearch 7.15 or later uses [niofs] for the [simplefs] store type " + - "as it offers superior or equivalent performance to [simplefs].", null) + "as it offers superior or equivalent performance to [simplefs].", false, null) )); } } diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java index 02d0dcb9db5ab..0886f0dfe28fd 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java @@ -80,6 +80,7 @@ public void testJavaVersion() { "Java 11 will be required for future versions of Elasticsearch, this node is running version [" + JavaVersion.current().toString() + "]. Consider switching to a distribution of Elasticsearch with a bundled JDK. " + "If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.", + false, null); if (isJvmEarlierThan11()) { @@ -99,7 +100,7 @@ public void testCheckPidfile() { DeprecationIssue.Level.CRITICAL, "setting [pidfile] is deprecated in favor of setting [node.pidfile]", "https://www.elastic.co/guide/en/elasticsearch/reference/7.4/breaking-changes-7.4.html#deprecate-pidfile", - "the setting [pidfile] is currently set to [" + pidfile + "], instead set [node.pidfile] to [" + pidfile + "]", null); + "the setting [pidfile] is currently set to [" + pidfile + "], instead set [node.pidfile] to [" + pidfile + "]", false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{Environment.PIDFILE_SETTING}); } @@ -115,7 +116,7 @@ public void testCheckProcessors() { "setting [processors] is deprecated in favor of setting [node.processors]", "https://www.elastic.co/guide/en/elasticsearch/reference/7.4/breaking-changes-7.4.html#deprecate-processors", "the setting [processors] is currently set to [" + processors + "], instead set [node.processors] to [" + processors + "]", - null); + false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{EsExecutors.PROCESSORS_SETTING}); } @@ -148,6 +149,7 @@ public void testCheckMissingRealmOrders() { "Found realms without order config: [%s]. In next major release, node will fail to start with missing realm order.", RealmSettings.realmSettingPrefix(invalidRealm) + RealmSettings.ORDER_SETTING_KEY ), + false, null ), deprecationIssues.get(0)); } @@ -390,7 +392,7 @@ public void testThreadPoolListenerQueueSize() { DeprecationIssue.Level.CRITICAL, "setting [thread_pool.listener.queue_size] is deprecated and will be removed in the next major version", "https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.7.html#deprecate-listener-thread-pool", - "the setting [thread_pool.listener.queue_size] is currently set to [" + size + "], remove this setting", null); + "the setting [thread_pool.listener.queue_size] is currently set to [" + size + "], remove this setting", false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new String[]{"thread_pool.listener.queue_size"}); } @@ -405,7 +407,7 @@ public void testThreadPoolListenerSize() { DeprecationIssue.Level.CRITICAL, "setting [thread_pool.listener.size] is deprecated and will be removed in the next major version", "https://www.elastic.co/guide/en/elasticsearch/reference/7.x/breaking-changes-7.7.html#deprecate-listener-thread-pool", - "the setting [thread_pool.listener.size] is currently set to [" + size + "], remove this setting", null); + "the setting [thread_pool.listener.size] is currently set to [" + size + "], remove this setting", false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new String[]{"thread_pool.listener.size"}); } @@ -421,7 +423,7 @@ public void testGeneralScriptSizeSetting() { "setting [script.cache.max_size] is deprecated in favor of grouped setting [script.context.*.cache_max_size]", "https://www.elastic.co/guide/en/elasticsearch/reference/7.9/breaking-changes-7.9.html#deprecate_general_script_cache_size", "the setting [script.cache.max_size] is currently set to [" + size + "], instead set [script.context.*.cache_max_size] " + - "to [" + size + "] where * is a script context", null); + "to [" + size + "] where * is a script context", false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{ScriptService.SCRIPT_GENERAL_CACHE_SIZE_SETTING}); } @@ -437,7 +439,7 @@ public void testGeneralScriptExpireSetting() { "setting [script.cache.expire] is deprecated in favor of grouped setting [script.context.*.cache_expire]", "https://www.elastic.co/guide/en/elasticsearch/reference/7.9/breaking-changes-7.9.html#deprecate_general_script_expire", "the setting [script.cache.expire] is currently set to [" + expire + "], instead set [script.context.*.cache_expire] to " + - "[" + expire + "] where * is a script context", null); + "[" + expire + "] where * is a script context", false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{ScriptService.SCRIPT_GENERAL_CACHE_EXPIRE_SETTING}); } @@ -453,7 +455,7 @@ public void testGeneralScriptCompileSettings() { "setting [script.max_compilations_rate] is deprecated in favor of grouped setting [script.context.*.max_compilations_rate]", "https://www.elastic.co/guide/en/elasticsearch/reference/7.9/breaking-changes-7.9.html#deprecate_general_script_compile_rate", "the setting [script.max_compilations_rate] is currently set to [" + rate + - "], instead set [script.context.*.max_compilations_rate] to [" + rate + "] where * is a script context", null); + "], instead set [script.context.*.max_compilations_rate] to [" + rate + "] where * is a script context", false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{ScriptService.SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING}); } @@ -474,7 +476,7 @@ public void testClusterRemoteConnectSetting() { RemoteClusterService.ENABLE_REMOTE_CLUSTERS.getKey(), value, "node.remote_cluster_client" - ), null); + ), false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{RemoteClusterService.ENABLE_REMOTE_CLUSTERS}); } @@ -489,7 +491,7 @@ public void testNodeLocalStorageSetting() { DeprecationIssue.Level.CRITICAL, "setting [node.local_storage] is deprecated and will be removed in the next major version", "https://www.elastic.co/guide/en/elasticsearch/reference/7.8/breaking-changes-7.8.html#deprecate-node-local-storage", - "the setting [node.local_storage] is currently set to [" + value + "], remove this setting", null + "the setting [node.local_storage] is currently set to [" + value + "], remove this setting", false, null ); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{Node.NODE_LOCAL_STORAGE_SETTING}); @@ -519,7 +521,7 @@ public void testDeprecatedBasicLicenseSettings() { "setting [" + deprecatedSetting.getKey() + "] is deprecated and will be removed in the next major version", "https://www.elastic.co/guide/en/elasticsearch/reference/7.8/breaking-changes-7.8.html" + "#deprecate-basic-license-feature-enabled", - "the setting [" + deprecatedSetting.getKey() + "] is currently set to [" + value + "], remove this setting", null + "the setting [" + deprecatedSetting.getKey() + "] is currently set to [" + value + "], remove this setting", false, null ); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{deprecatedSetting}); @@ -546,7 +548,7 @@ public void testLegacyRoleSettings() { "setting [" + legacyRoleSetting.getKey() + "] is deprecated in favor of setting [node.roles]", "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html#breaking_80_settings_changes", "the setting [" + legacyRoleSetting.getKey() + "] is currently set to [" - + value + "], instead set [node.roles] to [" + roles + "]", null + + value + "], instead set [node.roles] to [" + roles + "]", false, null ); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{legacyRoleSetting}); @@ -568,7 +570,7 @@ public void testCheckBootstrapSystemCallFilterSetting() { "setting [bootstrap.system_call_filter] is deprecated and will be removed in the next major version", "https://www.elastic.co/guide/en/elasticsearch/reference/7.13/breaking-changes-7.13.html#deprecate-system-call-filter-setting", "the setting [bootstrap.system_call_filter] is currently set to [" + boostrapSystemCallFilter + "], remove this setting", - null); + false, null); assertThat(issues, hasItem(expected)); assertSettingDeprecationsAndWarnings(new Setting[]{BootstrapSettings.SYSTEM_CALL_FILTER_SETTING}); } @@ -690,7 +692,7 @@ public void testSharedDataPathSetting() { "setting [path.shared_data] is deprecated and will be removed in a future version", expectedUrl, "Found shared data path configured. Discontinue use of this setting.", - null))); + false, null))); } public void testSingleDataNodeWatermarkSettingExplicit() { @@ -710,6 +712,7 @@ public void testSingleDataNodeWatermarkSettingExplicit() { expectedUrl, "found [cluster.routing.allocation.disk.watermark.enable_for_single_data_node] configured to false." + " Discontinue use of this setting or set it to true.", + false, null ))); @@ -739,7 +742,7 @@ public void testSingleDataNodeWatermarkSettingDefault() { expectedUrl, "found [cluster.routing.allocation.disk.watermark.enable_for_single_data_node] defaulting to false" + " on a single data node cluster. Set it to true to avoid this warning." + - " Consider using [cluster.routing.allocation.disk.threshold_enabled] to disable disk based allocation", null); + " Consider using [cluster.routing.allocation.disk.threshold_enabled] to disable disk based allocation", false, null); assertThat(issues, hasItem(deprecationIssue)); @@ -788,7 +791,7 @@ public void testMonitoringExporterPassword() { Locale.ROOT, "replace the non-secure monitoring exporter password setting(s) [%s] with their secure 'auth.secure_password' replacement", joinedNames - ), null))); + ), false, null))); // test for absence of deprecated exporter passwords issue = NodeDeprecationChecks.checkMonitoringExporterPassword(Settings.builder().build(), null, null, licenseState); @@ -810,7 +813,7 @@ public void testClusterRoutingAllocationIncludeRelocationsSetting() { "the setting [%s] is currently set to [%b], remove this setting", settingKey, settingValue), - null + false,null ); assertThat( diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/TransportDeprecationInfoActionTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/TransportDeprecationInfoActionTests.java index 55fc1bec41898..b2db915671088 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/TransportDeprecationInfoActionTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/TransportDeprecationInfoActionTests.java @@ -4,7 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - package org.elasticsearch.xpack.deprecation; import org.elasticsearch.action.ActionListener; @@ -17,6 +16,7 @@ import java.util.List; import java.util.Map; +import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; import static org.hamcrest.Matchers.containsString; @@ -30,9 +30,11 @@ public void testPluginSettingIssues() { DeprecationChecker.Components components = new DeprecationChecker.Components(null, Settings.EMPTY, null, null); PlainActionFuture>> future = new PlainActionFuture<>(); TransportDeprecationInfoAction.pluginSettingIssues(Arrays.asList( - new NamedChecker("foo", Collections.emptyList(), false), - new NamedChecker("bar", singletonList(new DeprecationIssue(DeprecationIssue.Level.WARNING, "bar msg", "", "details", - singletonMap("key", "value"))), false)), + new NamedChecker("foo", Collections.emptyList(), false), + new NamedChecker("bar", + singletonList(new DeprecationIssue(DeprecationIssue.Level.WARNING, "bar msg", "", "details", false, + singletonMap("key", "value"))), + false)), components, future ); @@ -41,6 +43,7 @@ public void testPluginSettingIssues() { assertThat(issueMap.get("foo"), is(empty())); assertThat(issueMap.get("bar").get(0).getMessage(), equalTo("bar msg")); assertThat(issueMap.get("bar").get(0).getDetails(), equalTo("details")); + assertThat(issueMap.get("bar").get(0).isResolveDuringRollingUpgrade(), is(false)); assertThat(issueMap.get("bar").get(0).getMeta(), equalTo(singletonMap("key", "value"))); } @@ -48,9 +51,9 @@ public void testPluginSettingIssuesWithFailures() { DeprecationChecker.Components components = new DeprecationChecker.Components(null, Settings.EMPTY, null, null); PlainActionFuture>> future = new PlainActionFuture<>(); TransportDeprecationInfoAction.pluginSettingIssues(Arrays.asList( - new NamedChecker("foo", Collections.emptyList(), false), + new NamedChecker("foo", emptyList(), false), new NamedChecker("bar", - singletonList(new DeprecationIssue(DeprecationIssue.Level.WARNING, "bar msg", "", null, null)), + singletonList(new DeprecationIssue(DeprecationIssue.Level.WARNING, "bar msg", "", null, false, null)), true)), components, future