mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
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
1c0380dc21
commit
57bd64aaec
4 changed files with 32 additions and 5 deletions
|
@ -92,6 +92,10 @@ ES_DISTRIBUTION_FLAVOR=${es.distribution.flavor}
|
||||||
ES_DISTRIBUTION_TYPE=${es.distribution.type}
|
ES_DISTRIBUTION_TYPE=${es.distribution.type}
|
||||||
ES_BUNDLED_JDK=${es.bundled_jdk}
|
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
|
if [[ "$ES_DISTRIBUTION_TYPE" == "docker" ]]; then
|
||||||
# Allow environment variables to be set by creating a file with the
|
# Allow environment variables to be set by creating a file with the
|
||||||
# contents, and setting an environment variable with the suffix _FILE to
|
# 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_DISTRIBUTION_TYPE=${es.distribution.type}
|
||||||
set ES_BUNDLED_JDK=${es.bundled_jdk}
|
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%"
|
cd /d "%ES_HOME%"
|
||||||
|
|
||||||
rem now set the path to java, pass "nojava" arg to skip setting JAVA_HOME and JAVA
|
rem now set the path to java, pass "nojava" arg to skip setting JAVA_HOME and JAVA
|
||||||
|
|
|
@ -70,6 +70,7 @@ import org.elasticsearch.common.inject.Key;
|
||||||
import org.elasticsearch.common.inject.ModulesBuilder;
|
import org.elasticsearch.common.inject.ModulesBuilder;
|
||||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||||
import org.elasticsearch.common.lease.Releasables;
|
import org.elasticsearch.common.lease.Releasables;
|
||||||
|
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||||
import org.elasticsearch.common.logging.HeaderWarning;
|
import org.elasticsearch.common.logging.HeaderWarning;
|
||||||
import org.elasticsearch.common.logging.NodeAndClusterIdStateListener;
|
import org.elasticsearch.common.logging.NodeAndClusterIdStateListener;
|
||||||
import org.elasticsearch.common.network.NetworkAddress;
|
import org.elasticsearch.common.network.NetworkAddress;
|
||||||
|
@ -252,10 +253,15 @@ public class Node implements Closeable {
|
||||||
private final Lifecycle lifecycle = new Lifecycle();
|
private final Lifecycle lifecycle = new Lifecycle();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger initialized in the ctor because if it were initialized statically
|
* This logger instance is an instance field as opposed to a static field. This ensures that the field is not
|
||||||
* then it wouldn't get the node name.
|
* 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 Injector injector;
|
||||||
private final Environment environment;
|
private final Environment environment;
|
||||||
private final NodeEnvironment nodeEnvironment;
|
private final NodeEnvironment nodeEnvironment;
|
||||||
|
@ -280,7 +286,6 @@ public class Node implements Closeable {
|
||||||
*/
|
*/
|
||||||
protected Node(final Environment initialEnvironment,
|
protected Node(final Environment initialEnvironment,
|
||||||
Collection<Class<? extends Plugin>> classpathPlugins, boolean forbidPrivateIndexSettings) {
|
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
|
final List<Closeable> resourcesToClose = new ArrayList<>(); // register everything we need to release in the case of an error
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
|
@ -307,6 +312,9 @@ public class Node implements Closeable {
|
||||||
logger.info("JVM home [{}], using bundled JDK [{}]", System.getProperty("java.home"), jvmInfo.getUsingBundledJdk());
|
logger.info("JVM home [{}], using bundled JDK [{}]", System.getProperty("java.home"), jvmInfo.getUsingBundledJdk());
|
||||||
} else {
|
} else {
|
||||||
logger.info("JVM home [{}]", System.getProperty("java.home"));
|
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()));
|
logger.info("JVM arguments {}", Arrays.toString(jvmInfo.getInputArguments()));
|
||||||
if (Build.CURRENT.isProductionRelease() == false) {
|
if (Build.CURRENT.isProductionRelease() == false) {
|
||||||
|
|
|
@ -98,6 +98,7 @@ import org.elasticsearch.index.analysis.IndexAnalyzers;
|
||||||
import org.elasticsearch.index.analysis.TokenFilterFactory;
|
import org.elasticsearch.index.analysis.TokenFilterFactory;
|
||||||
import org.elasticsearch.index.analysis.TokenizerFactory;
|
import org.elasticsearch.index.analysis.TokenizerFactory;
|
||||||
import org.elasticsearch.indices.analysis.AnalysisModule;
|
import org.elasticsearch.indices.analysis.AnalysisModule;
|
||||||
|
import org.elasticsearch.monitor.jvm.JvmInfo;
|
||||||
import org.elasticsearch.plugins.AnalysisPlugin;
|
import org.elasticsearch.plugins.AnalysisPlugin;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.script.MockScriptEngine;
|
import org.elasticsearch.script.MockScriptEngine;
|
||||||
|
@ -408,7 +409,17 @@ public abstract class ESTestCase extends LuceneTestCase {
|
||||||
//appropriate test
|
//appropriate test
|
||||||
try {
|
try {
|
||||||
final List<String> warnings = threadContext.getResponseHeaders().get("Warning");
|
final List<String> warnings = threadContext.getResponseHeaders().get("Warning");
|
||||||
|
if (warnings != null && 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
|
||||||
|
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)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
assertThat("unexpected warning headers", filteredWarnings, empty());
|
||||||
|
} else {
|
||||||
assertNull("unexpected warning headers", warnings);
|
assertNull("unexpected warning headers", warnings);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
resetDeprecationLogger();
|
resetDeprecationLogger();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue