Skip to content

Commit

Permalink
Additional deprecation info API checks (#80233)
Browse files Browse the repository at this point in the history
This commit adds deprecation info api messages for several settings that have been deprecated that were
missed until now.
  • Loading branch information
masseyke committed Nov 3, 2021
1 parent f733421 commit 173be84
Show file tree
Hide file tree
Showing 6 changed files with 740 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public class ZenDiscovery extends AbstractLifecycleComponent implements Discover
public static final Setting<TimeValue> PING_TIMEOUT_SETTING = Setting.positiveTimeSetting(
"discovery.zen.ping_timeout",
timeValueSeconds(3),
Property.NodeScope
Property.NodeScope,
Property.Deprecated
);
public static final Setting<TimeValue> JOIN_TIMEOUT_SETTING = Setting.timeSetting(
"discovery.zen.join_timeout",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -60,13 +61,27 @@ private DeprecationChecks() {}
static final List<
NodeDeprecationCheck<Settings, PluginsAndModules, ClusterState, XPackLicenseState, DeprecationIssue>> NODE_SETTINGS_CHECKS;

private static Set<Setting<Boolean>> getAllDeprecatedNodeRolesSettings() {
Set<Setting<Boolean>> deprecatedNodeRolesSettings = DiscoveryNode.getPossibleRoles()
.stream()
.map(r -> r.legacySetting())
.filter(s -> s != null)
.collect(Collectors.toSet());
deprecatedNodeRolesSettings.add(
Setting.boolSetting("node.voting_only", false, Setting.Property.Deprecated, Setting.Property.NodeScope)
);
deprecatedNodeRolesSettings.add(Setting.boolSetting("node.ml", true, Setting.Property.Deprecated, Setting.Property.NodeScope));
deprecatedNodeRolesSettings.add(
Setting.boolSetting("node.transform", true, Setting.Property.Deprecated, Setting.Property.NodeScope)
);
return deprecatedNodeRolesSettings;
}

static {
final Stream<
NodeDeprecationCheck<Settings, PluginsAndModules, ClusterState, XPackLicenseState, DeprecationIssue>> legacyRoleSettings =
DiscoveryNode.getPossibleRoles()
.stream()
.filter(r -> r.legacySetting() != null)
.map(r -> (s, p, t, c) -> NodeDeprecationChecks.checkLegacyRoleSettings(r.legacySetting(), s, p));
getAllDeprecatedNodeRolesSettings().stream()
.map(setting -> (s, p, t, c) -> NodeDeprecationChecks.checkLegacyRoleSettings(setting, s, p));
NODE_SETTINGS_CHECKS = Stream.concat(
legacyRoleSettings,
Stream.of(
Expand Down Expand Up @@ -175,7 +190,30 @@ private DeprecationChecks() {}
NodeDeprecationChecks::checkScriptContextCache,
NodeDeprecationChecks::checkScriptContextCompilationsRateLimitSetting,
NodeDeprecationChecks::checkScriptContextCacheSizeSetting,
NodeDeprecationChecks::checkScriptContextCacheExpirationSetting
NodeDeprecationChecks::checkScriptContextCacheExpirationSetting,
NodeDeprecationChecks::checkReroutePrioritySetting,
NodeDeprecationChecks::checkZenBwcPingTimeoutSetting,
NodeDeprecationChecks::checkZenUnsafeBootstrappingOnUpgradeSetting,
NodeDeprecationChecks::checkZenCommitTimeoutSetting,
NodeDeprecationChecks::checkZenPublishDiffEnableSetting,
NodeDeprecationChecks::checkZenConnectOnNetworkDisconnectSetting,
NodeDeprecationChecks::checkZenPingIntervalSetting,
NodeDeprecationChecks::checkZenPingTimeoutSetting,
NodeDeprecationChecks::checkZenPingRetriesSetting,
NodeDeprecationChecks::checkZenRegisterConnectionListenerSetting,
NodeDeprecationChecks::checkAutoImportDanglingIndicesSetting,
NodeDeprecationChecks::checkHttpContentTypeRequiredSetting,
NodeDeprecationChecks::checkFsRepositoryCompressionSetting,
NodeDeprecationChecks::checkHttpTcpNoDelaySetting,
NodeDeprecationChecks::checkNetworkTcpConnectTimeoutSetting,
NodeDeprecationChecks::checkTransportTcpConnectTimeoutSetting,
NodeDeprecationChecks::checkTransportPortSetting,
NodeDeprecationChecks::checkTcpNoDelaySetting,
NodeDeprecationChecks::checkTransportCompressSetting,
NodeDeprecationChecks::checkXpackDataFrameEnabledSetting,
NodeDeprecationChecks::checkWatcherHistoryCleanerServiceSetting,
NodeDeprecationChecks::checkLifecyleStepMasterTimeoutSetting,
NodeDeprecationChecks::checkEqlEnabledSetting
)
).collect(Collectors.toList());
}
Expand All @@ -198,6 +236,8 @@ private DeprecationChecks() {}
(clusterState, indexMetadata) -> IndexDeprecationChecks.checkIndexMatrixFiltersSetting(indexMetadata),
(clusterState, indexMetadata) -> IndexDeprecationChecks.checkGeoShapeMappings(indexMetadata),
(clusterState, indexMetadata) -> IndexDeprecationChecks.frozenIndexSettingCheck(indexMetadata),
(clusterState, indexMetadata) -> IndexDeprecationChecks.httpContentTypeRequiredSettingCheck(indexMetadata),
(clusterState, indexMetadata) -> IndexDeprecationChecks.mapperDyamicSettingCheck(indexMetadata),
IndexDeprecationChecks::emptyDataTierPreferenceCheck
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.elasticsearch.index.SlowLogLevel;
import org.elasticsearch.index.engine.frozen.FrozenEngine;
import org.elasticsearch.index.mapper.GeoShapeFieldMapper;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.store.Store;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;

Expand Down Expand Up @@ -367,7 +369,7 @@ static DeprecationIssue checkIndexDataPath(IndexMetadata indexMetadata) {
"Remove the [%s] setting. This setting has had no effect since 6.0.",
IndexMetadata.INDEX_DATA_PATH_SETTING.getKey()
);
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null);
return new DeprecationIssue(DeprecationIssue.Level.WARNING, message, url, details, false, null);
}
return null;
}
Expand Down Expand Up @@ -575,4 +577,26 @@ static DeprecationIssue emptyDataTierPreferenceCheck(ClusterState clusterState,
}
return null;
}

static DeprecationIssue checkSettingNoReplacement(IndexMetadata indexMetadata, Setting<?> deprecatedSetting, String url) {
return NodeDeprecationChecks.checkSettingNoReplacement(indexMetadata.getSettings(), deprecatedSetting, url);
}

static DeprecationIssue httpContentTypeRequiredSettingCheck(IndexMetadata indexMetadata) {
Setting<Boolean> deprecatedSetting = Store.FORCE_RAM_TERM_DICT;
String url = "https://ela.st/es-deprecation-7-force-memory-term-dictionary-setting";
return checkRemovedSetting(
indexMetadata.getSettings(),
deprecatedSetting,
url,
"This setting no longer has any effect.",
DeprecationIssue.Level.CRITICAL
);
}

static DeprecationIssue mapperDyamicSettingCheck(IndexMetadata indexMetadata) {
Setting<Boolean> deprecatedSetting = MapperService.INDEX_MAPPER_DYNAMIC_SETTING;
String url = "https://ela.st/es-deprecation-7-mapper-dynamic-setting";
return checkSettingNoReplacement(indexMetadata, deprecatedSetting, url);
}
}

0 comments on commit 173be84

Please sign in to comment.