Skip to content

[8.2] Forward port MDP deprecation info api (#86103) #86147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/86103.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 86103
summary: Forward port MDP deprecation info api
area: Infra/Core
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ private DeprecationChecks() {}
static final List<
NodeDeprecationCheck<Settings, PluginsAndModules, ClusterState, XPackLicenseState, DeprecationIssue>> NODE_SETTINGS_CHECKS = List
.of(
NodeDeprecationChecks::checkMultipleDataPaths,
NodeDeprecationChecks::checkDataPathsList,
NodeDeprecationChecks::checkSharedDataPathSetting,
NodeDeprecationChecks::checkReservedPrefixedRealmNames,
NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,47 @@ static DeprecationIssue checkRemovedSetting(
return new DeprecationIssue(deprecationLevel, message, url, details, false, meta);
}

static DeprecationIssue checkMultipleDataPaths(
Settings nodeSettings,
PluginsAndModules plugins,
final ClusterState clusterState,
final XPackLicenseState licenseState
) {
List<String> dataPaths = Environment.PATH_DATA_SETTING.get(nodeSettings);
if (dataPaths.size() > 1) {
return new DeprecationIssue(
DeprecationIssue.Level.WARNING,
"Specifying multiple data paths is deprecated",
"https://ela.st/es-deprecation-7-multiple-paths",
"The [path.data] setting contains a list of paths. Specify a single path as a string. Use RAID or other system level "
+ "features to utilize multiple disks. If multiple data paths are configured, the node will fail to start in 8.0. ",
false,
null
);
}
return null;
}

static DeprecationIssue checkDataPathsList(
Settings nodeSettings,
PluginsAndModules plugins,
final ClusterState clusterState,
final XPackLicenseState licenseState
) {
if (Environment.dataPathUsesList(nodeSettings)) {
return new DeprecationIssue(
DeprecationIssue.Level.WARNING,
"Multiple data paths are not supported",
"https://ela.st/es-deprecation-7-multiple-paths",
"The [path.data] setting contains a list of paths. Specify a single path as a string. Use RAID or other system level "
+ "features to utilize multiple disks. If multiple data paths are configured, the node will fail to start in 8.0. ",
false,
null
);
}
return null;
}

static DeprecationIssue checkSharedDataPathSetting(
final Settings settings,
final PluginsAndModules pluginsAndModules,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.elasticsearch.xpack.core.ilm.LifecycleSettings;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -75,6 +76,56 @@ public void testRemovedSetting() {
assertThat(issue.getUrl(), equalTo("https://removed-setting.example.com"));
}

public void testMultipleDataPaths() {
final Settings settings = Settings.builder().putList("path.data", Arrays.asList("d1", "d2")).build();
final XPackLicenseState licenseState = new XPackLicenseState(() -> 0);
final DeprecationIssue issue = NodeDeprecationChecks.checkMultipleDataPaths(settings, null, null, licenseState);
assertThat(issue, not(nullValue()));
assertThat(issue.getLevel(), equalTo(DeprecationIssue.Level.WARNING));
assertThat(issue.getMessage(), equalTo("Specifying multiple data paths is deprecated"));
assertThat(
issue.getDetails(),
equalTo(
"The [path.data] setting contains a list of paths. Specify a single path as a string. Use RAID or other system level "
+ "features to utilize multiple disks. If multiple data paths are configured, the node will fail to start in 8.0. "
)
);
String url = "https://ela.st/es-deprecation-7-multiple-paths";
assertThat(issue.getUrl(), equalTo(url));
}

public void testNoMultipleDataPaths() {
Settings settings = Settings.builder().put("path.data", "data").build();
final XPackLicenseState licenseState = new XPackLicenseState(() -> 0);
final DeprecationIssue issue = NodeDeprecationChecks.checkMultipleDataPaths(settings, null, null, licenseState);
assertThat(issue, nullValue());
}

public void testDataPathsList() {
final Settings settings = Settings.builder().putList("path.data", "d1").build();
final XPackLicenseState licenseState = new XPackLicenseState(() -> 0);
final DeprecationIssue issue = NodeDeprecationChecks.checkDataPathsList(settings, null, null, licenseState);
assertThat(issue, not(nullValue()));
assertThat(issue.getLevel(), equalTo(DeprecationIssue.Level.WARNING));
assertThat(issue.getMessage(), equalTo("Multiple data paths are not supported"));
assertThat(
issue.getDetails(),
equalTo(
"The [path.data] setting contains a list of paths. Specify a single path as a string. Use RAID or other system level "
+ "features to utilize multiple disks. If multiple data paths are configured, the node will fail to start in 8.0. "
)
);
String url = "https://ela.st/es-deprecation-7-multiple-paths";
assertThat(issue.getUrl(), equalTo(url));
}

public void testNoDataPathsListDefault() {
final Settings settings = Settings.builder().build();
final XPackLicenseState licenseState = new XPackLicenseState(() -> 0);
final DeprecationIssue issue = NodeDeprecationChecks.checkDataPathsList(settings, null, null, licenseState);
assertThat(issue, nullValue());
}

public void testSharedDataPathSetting() {
Settings settings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
Expand Down