Deprecate the no-jdk distributions (#64275)
This commit adds logging to indicate that the no-jdk distributions are deprecated and will be removed in a future release.
This commit is contained in:
parent
72009a9edd
commit
5d42c2b06e
|
@ -92,6 +92,10 @@ ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor}
|
|||
ES_DISTRIBUTION_TYPE=${es.distribution.type}
|
||||
ES_BUNDLED_JDK=${es.bundled_jdk}
|
||||
|
||||
if [[ "$ES_BUNDLED_JDK" == "false" ]]; then
|
||||
echo "warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release" >&2
|
||||
fi
|
||||
|
||||
if [[ "$ES_DISTRIBUTION_TYPE" == "docker" ]]; then
|
||||
# Allow environment variables to be set by creating a file with the
|
||||
# contents, and setting an environment variable with the suffix _FILE to
|
||||
|
|
|
@ -29,6 +29,10 @@ set ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor}
|
|||
set ES_DISTRIBUTION_TYPE=${es.distribution.type}
|
||||
set ES_BUNDLED_JDK=${es.bundled_jdk}
|
||||
|
||||
if "%ES_BUNDLED_JDK%" == "false" (
|
||||
echo "warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release" >&2
|
||||
)
|
||||
|
||||
cd /d "%ES_HOME%"
|
||||
|
||||
rem now set the path to java, pass "nojava" arg to skip setting JAVA_HOME and JAVA
|
||||
|
|
|
@ -73,6 +73,7 @@ import org.elasticsearch.common.inject.Module;
|
|||
import org.elasticsearch.common.inject.ModulesBuilder;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.common.lease.Releasables;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.logging.HeaderWarning;
|
||||
import org.elasticsearch.common.logging.NodeAndClusterIdStateListener;
|
||||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
|
@ -266,10 +267,15 @@ public class Node implements Closeable {
|
|||
private final Lifecycle lifecycle = new Lifecycle();
|
||||
|
||||
/**
|
||||
* Logger initialized in the ctor because if it were initialized statically
|
||||
* then it wouldn't get the node name.
|
||||
* This logger instance is an instance field as opposed to a static field. This ensures that the field is not
|
||||
* initialized until an instance of Node is constructed, which is sure to happen after the logging infrastructure
|
||||
* has been initialized to include the hostname. If this field were static, then it would be initialized when the
|
||||
* class initializer runs. Alas, this happens too early, before logging is initialized as this class is referred to
|
||||
* in InternalSettingsPreparer#finalizeSettings, which runs when creating the Environment, before logging is
|
||||
* initialized.
|
||||
*/
|
||||
private final Logger logger;
|
||||
private final Logger logger = LogManager.getLogger(Node.class);
|
||||
private final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(Node.class);
|
||||
private final Injector injector;
|
||||
private final Environment environment;
|
||||
private final NodeEnvironment nodeEnvironment;
|
||||
|
@ -293,7 +299,6 @@ public class Node implements Closeable {
|
|||
*/
|
||||
protected Node(final Environment initialEnvironment,
|
||||
Collection<Class<? extends Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings) {
|
||||
logger = LogManager.getLogger(Node.class);
|
||||
final List<Closeable> resourcesToClose = new ArrayList<>(); // register everything we need to release in the case of an error
|
||||
boolean success = false;
|
||||
try {
|
||||
|
@ -320,6 +325,9 @@ public class Node implements Closeable {
|
|||
logger.info("JVM home [{}], using bundled JDK [{}]", System.getProperty("java.home"), jvmInfo.getUsingBundledJdk());
|
||||
} else {
|
||||
logger.info("JVM home [{}]", System.getProperty("java.home"));
|
||||
deprecationLogger.deprecate(
|
||||
"no-jdk",
|
||||
"no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release");
|
||||
}
|
||||
logger.info("JVM arguments {}", Arrays.toString(jvmInfo.getInputArguments()));
|
||||
if (Build.CURRENT.isProductionRelease() == false) {
|
||||
|
|
|
@ -100,6 +100,7 @@ import org.elasticsearch.index.analysis.IndexAnalyzers;
|
|||
import org.elasticsearch.index.analysis.TokenFilterFactory;
|
||||
import org.elasticsearch.index.analysis.TokenizerFactory;
|
||||
import org.elasticsearch.indices.analysis.AnalysisModule;
|
||||
import org.elasticsearch.monitor.jvm.JvmInfo;
|
||||
import org.elasticsearch.plugins.AnalysisPlugin;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.script.MockScriptEngine;
|
||||
|
@ -415,10 +416,20 @@ public abstract class ESTestCase extends LuceneTestCase {
|
|||
//appropriate test
|
||||
try {
|
||||
final List<String> warnings = threadContext.getResponseHeaders().get("Warning");
|
||||
if (warnings != null && enableJodaDeprecationWarningsCheck() == false) {
|
||||
List<String> filteredWarnings = filterJodaDeprecationWarnings(warnings);
|
||||
assertThat( filteredWarnings, empty());
|
||||
|
||||
if (warnings != null) {
|
||||
List<String> filteredWarnings = new ArrayList<>(warnings);
|
||||
if (enableJodaDeprecationWarningsCheck() == false) {
|
||||
filteredWarnings = filterJodaDeprecationWarnings(filteredWarnings);
|
||||
}
|
||||
if (JvmInfo.jvmInfo().getBundledJdk() == false) {
|
||||
// unit tests do not run with the bundled JDK, if there are warnings we need to filter the no-jdk deprecation warning
|
||||
filteredWarnings = filteredWarnings
|
||||
.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)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
assertThat("unexpected warning headers", filteredWarnings, empty());
|
||||
} else {
|
||||
assertNull("unexpected warning headers", warnings);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue