diff --git a/qa/os/src/test/java/org/elasticsearch/packaging/test/ConfigurationTests.java b/qa/os/src/test/java/org/elasticsearch/packaging/test/ConfigurationTests.java index 28e7fdad74032..57b5d9c5b7e80 100644 --- a/qa/os/src/test/java/org/elasticsearch/packaging/test/ConfigurationTests.java +++ b/qa/os/src/test/java/org/elasticsearch/packaging/test/ConfigurationTests.java @@ -24,8 +24,14 @@ import org.elasticsearch.packaging.util.Platforms; import org.junit.Before; +import java.nio.file.Files; +import java.util.List; + +import static java.nio.file.StandardOpenOption.APPEND; +import static java.nio.file.StandardOpenOption.CREATE; import static org.elasticsearch.packaging.util.FileUtils.append; import static org.elasticsearch.packaging.util.ServerUtils.makeRequest; +import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assume.assumeFalse; @@ -40,6 +46,19 @@ public void test10Install() throws Exception { install(); } + public void test50StrictDuplicateDetectionDeprecationWarning() throws Exception { + withCustomConfig(tempConf -> { + final List jvmOptions = org.elasticsearch.common.collect.List.of("-Des.xcontent.strict_duplicate_detection=false"); + Files.write(tempConf.resolve("jvm.options"), jvmOptions, CREATE, APPEND); + startElasticsearch(); + stopElasticsearch(); + }); + assertThat( + FileUtils.slurp(installation.logs.resolve("elasticsearch_deprecation.log")), + containsString("The Java option es.xcontent.strict_duplicate_detection is set") + ); + } + public void test60HostnameSubstitution() throws Exception { String hostnameKey = Platforms.WINDOWS ? "COMPUTERNAME" : "HOSTNAME"; sh.getEnv().put(hostnameKey, "mytesthost"); diff --git a/server/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java b/server/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java index 12d93bece67d5..b16fdf07f352b 100644 --- a/server/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java +++ b/server/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java @@ -364,6 +364,14 @@ static void init( System.getProperty("java.home")); DeprecationLogger.getLogger(Bootstrap.class).deprecate("java_version_11_required", message); } + if (BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection") != null) { + final String message = String.format( + Locale.ROOT, + "The Java option es.xcontent.strict_duplicate_detection is set to [%s]; " + + "this option is deprecated and non-functional and should be removed from Java configuration.", + BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection")); + DeprecationLogger.getLogger(Bootstrap.class).deprecate("strict_duplicate_detection_setting_removed", message); + } if (environment.pidFile() != null) { try { PidFile.create(environment.pidFile(), true);