Skip to content

Commit

Permalink
Deprecate multiple path.data entries (#71207)
Browse files Browse the repository at this point in the history
This commit adds a node level deprecation log message when multiple
data paths are specified.

relates #71205
  • Loading branch information
rjernst authored Apr 2, 2021
1 parent d3c56e6 commit 6cf4eb7
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
7 changes: 7 additions & 0 deletions server/src/main/java/org/elasticsearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ protected Node(final Environment initialEnvironment,
Build.CURRENT.getQualifiedVersion());
}

if (initialEnvironment.dataFiles().length > 1) {
// NOTE: we use initialEnvironment here, but assertEquivalent below ensures the data paths do not change
deprecationLogger.deprecate(DeprecationCategory.SETTINGS, "multiple-data-paths",
"Configuring multiple [path.data] paths is deprecated. Use RAID or other system level features for utilizing " +
"multiple disks. This feature will be removed in 8.0.");
}

if (logger.isDebugEnabled()) {
logger.debug("using config [{}], data [{}], logs [{}], plugins [{}]",
initialEnvironment.configFile(), Arrays.toString(initialEnvironment.dataFiles()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
import static org.elasticsearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
Expand Down Expand Up @@ -102,6 +103,13 @@ public final void startClusters() throws Exception {
configureAndConnectsToRemoteClusters();
}

@Override
public List<String> filteredWarnings() {
return Stream.concat(super.filteredWarnings().stream(),
List.of("Configuring multiple [path.data] paths is deprecated. Use RAID or other system level features for utilizing " +
"multiple disks. This feature will be removed in 8.0.").stream()).collect(Collectors.toList());
}

@After
public void assertAfterTest() throws Exception {
for (InternalTestCluster cluster : clusters().values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,11 @@ public void ensureNoWarnings() {
//appropriate test
try {
final List<String> warnings = threadContext.getResponseHeaders().get("Warning");
if (warnings != null && JvmInfo.jvmInfo().getBundledJdk() == false) {
if (warnings != null) {
// unit tests do not run with the bundled JDK, if there are warnings we need to filter the no-jdk deprecation warning
final List<String> filteredWarnings = warnings
.stream()
.filter(k -> k.contains(
"no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release") == false)
.filter(k -> filteredWarnings().stream().anyMatch(s -> s.contains(k)))
.collect(Collectors.toList());
assertThat("unexpected warning headers", filteredWarnings, empty());
} else {
Expand All @@ -423,6 +422,14 @@ public void ensureNoWarnings() {
}
}

protected List<String> filteredWarnings() {
if (JvmInfo.jvmInfo().getBundledJdk() == false) {
return List.of("no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release");
} else {
return List.of();
}
}

/**
* Convenience method to assert warnings for settings deprecations and general deprecation warnings.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFileExists;
Expand All @@ -60,6 +61,13 @@ private static Collection<Class<? extends Plugin>> mockPlugins() {
return Arrays.asList(getTestTransportPlugin(), MockHttpTransport.TestPlugin.class);
}

@Override
protected List<String> filteredWarnings() {
return Stream.concat(super.filteredWarnings().stream(),
List.of("Configuring multiple [path.data] paths is deprecated. Use RAID or other system level features for utilizing " +
"multiple disks. This feature will be removed in 8.0.").stream()).collect(Collectors.toList());
}

public void testInitializiationIsConsistent() {
long clusterSeed = randomLong();
boolean masterNodes = randomBoolean();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ public Collection<Class<? extends Plugin>> nodePlugins() {
};
}

@Override
public List<String> filteredWarnings() {
return Stream.concat(super.filteredWarnings().stream(),
List.of("Configuring multiple [path.data] paths is deprecated. Use RAID or other system level features for utilizing " +
"multiple disks. This feature will be removed in 8.0.").stream()).collect(Collectors.toList());
}

@AfterClass
public static void stopClusters() throws IOException {
IOUtils.close(clusterGroup);
Expand Down

0 comments on commit 6cf4eb7

Please sign in to comment.