Skip to content

Commit

Permalink
Forward port MDP deprecation info api (#86103)
Browse files Browse the repository at this point in the history
Multiple data paths was deprecated in 7.13. At the time, the deprecation
was only added to the deprecation logs. Later, it was also added to the
deprecation info api, but by that time, MDP had already been removed
from master. When MDP was added back to master, the deprecation log
messages were added back, but the info api messages were not since they
never existed in master.

This commit forward ports the deprecation info messages for MDP to 8.x.

relates #85695
  • Loading branch information
rjernst authored Apr 25, 2022
1 parent cfaf66f commit 108a54f
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
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

0 comments on commit 108a54f

Please sign in to comment.