Commit graph

1388 commits

Author SHA1 Message Date
Ryan Ernst
cf3dc57132
Remove no-jdk deprecations (#85765)
The no-jdk distributions exist in 7.x and before. They were removed with
8.0. This commit removes the remaining deprecation messages for using
the no-jdk distribution. Note that when talking with an older node, we
drop the bundledJdk attribute. This is ok because it is only possible
for this to not be true when talking with a 7.17 node, during an upgrade,
and the usingBundledJdk is retained, which is the important thing if
debugging a problem.

relates #76896
relates #85758
2022-04-11 14:52:31 -07:00
Ryan Ernst
b361ff2335
Use multi-release-jar for java version checker (#85767)
The java version checker tests whether the current jdk is a sufficient
version to run Elasticsearch. Since it is compatible with java 7, it
must parse Java's version sysprop.

This commit reworks the checker to no longer need to parse the version.
Instead, it uses a multi-release-jar, so that there are two versions of
the main class. The Java 7 compatible version simply exits with an error
message. The Java 17 version simple exits with no error.

relates #85758
2022-04-11 14:52:01 -07:00
Ryan Ernst
c935f694da
Remove xshare shell logic (#85764)
When adding aarch64 support to Elasticsearch, a bug existed in the jdk
which caused an error message to be printed on every invocation of Java
due to page size misalignment (see
https://bugs.openjdk.java.net/browse/JDK-8236847). This bug was fixed in
Java 17. Since the main branch always uses Java 17, the workaround is no
longer necessary.

relates #85758
2022-04-11 14:47:50 -07:00
Ryan Ernst
284cb8df99
Only check java version with custom ES_JAVA_HOME (#85766)
The java version checker is intended to ensure the version of the JDK
that Elasticsearch will use is at least the version Elasticsearch was
compiled against. It prevents cryptic class version errors upon loading.
The bundled jdk is always of the appropriate version.

This commit moves the version check to only occur when a custom
ES_JAVA_HOME is used. If a user were to swap out the bundled jdk with
their own, it could result in the cryptic errors being protected
against, but replacing the bundled jdk is not something we need nice
error messages for.

relates #85758
2022-04-11 13:05:50 -07:00
Ryan Ernst
3c92b44bee
Remove pre Java 17 system jvm options (#85762)
This commit removes the one conditional jvm option that was dependent on
the Java version priority 17, which was whether to add
`-XX:+ShowCodeDetailsInExceptionMessages`. This option is available
since Java 14, and actually the default since Java 15, so the flag is simply
not needed anymore.

relates #85758
2022-04-11 08:32:50 -07:00
Lee Hinman
3a3ee6e342
Bump commons-compress to 1.21 (#85581)
This updates the dependency version for the Apache commons compress
project to 1.21
2022-04-04 01:04:35 -04:00
Rick Boyd
a476abdc71
Various updates related to minimum Java version 17 (#85545)
Since 8.0.0, we only support Java 17 and up. This change cleans up unsupported Java versions from jvm.options and updates documentation to reference supported Java versions, in case it is confusing to users.
2022-03-31 10:04:50 -04:00
Nikola Grcevski
344649573d
Introduce an unauthenticated endpoint for readiness checks (#84375)
Add optional Elasticsearch readiness TCP listener.
2022-03-25 10:38:06 -04:00
Rene Groeschke
579695d032
Update nebula plugins improving configuration cache support (#85316) 2022-03-24 13:55:54 +01:00
Przemyslaw Gomulka
4958642404
Disable deprecation log indexing in docker test (#85150)
Deprecation log indexing can make test very fragile
and randomly failing during cluster cleanup.
This commit disables indexing of deprecation logs for :distribution:docker tests

closes #79803
2022-03-21 12:05:49 +01:00
Rene Groeschke
00f2dc09ff
Avoid overhead of zip / unzip modules when packaging distribution (#84660)
This removes the overhead of zipping up modules that are immediately unzipped again when packaging
the elasticsearch distribution.
We also move some logic for packaging the elasticsearch distribution into a plugin and remove some outdated
overhead dealing with 'meta plugins' when copying modules into a distribution.

Another follow up and related optimization out of scope of this PR is, to also not zip unzip modules declared
for usage in our test cluster setups.

This partially addresses #76726.
2022-03-15 11:37:47 +01:00
Mark Vieira
0c6f131fbf
Remove usages of elasticsearch.build plugin in non-production projects (#84890) 2022-03-14 11:27:24 -07:00
Nikola Grcevski
5ae99a6297
Warn on slow signature verification (#84766)
Plugin downloads can sometimes take unexpectedly
long because of slow random number generation on certain
operating system versions, e.g. Debian based OS
distros with kernels older than 5.6. This PR adds
a warning message for users explaining why plugin
installation from remote URLs is taking unexpectedly long.
2022-03-11 16:28:16 -05:00
Ievgen Degtiarenko
01c5bc04e8
replace .collect(toUnmodifiableList()) with .toList() (#84760)
Replace collect with a simipler toList call that also creates immutable
collection.
2022-03-10 10:27:46 +01:00
Ryan Ernst
5f06b5f627
Add x-content testing jar (#84775)
This commit adds a jar separate from the test framework to provide
utilities for testing x-content related code. The first thing moved
there is the base schema validation test case, which also pulls along
the com.networknt dependency and jackson. For now these are direct
dependencies, though we could consider shading them in the future so as
not to expose downstream projects to them, which may have version
conflicts.
2022-03-09 09:48:34 -08:00
Chris Hegarty
50528d5d79
Add missing explicit no-args ctors (#84763) 2022-03-09 11:08:48 +00:00
Ryan Ernst
070fcaa0ad
Move x-content implementation to a separate classloader (#83705)
This change isolates the Jackson implementation of x-content parsers and generators to a separate classloader. The code is loaded dynamically upon accessing any x-content functionality.

The x-content implementation is embedded inside the x-content jar, as a hidden set of resource files. These are loaded through a special classloader created to initialize the XContentProvider through service loader. One caveat to this approach is that IDEs will no longer trigger building the x-content implementation when it changes. However, running any test from the command line, or running a full Build in IntelliJ will trigger the directory to be built.

Co-authored-by: ChrisHegarty <christopher.hegarty@elastic.co>
2022-03-07 15:44:59 -08:00
Rory Hunter
728ef33844
Remove use of Cloudflare zlib (#84680)
Relates to #81662. This library isn't ready for public consumption.
Remove it from the Docker build.
2022-03-07 10:03:39 +00:00
Mark Vieira
e7b29abf11
Use 'main' when referring to default branch (#84463)
Replace any old references of master with main. These are mostly
cosmetic, as the name of the default branch doesn't actually affect the
build in any meaningful way.
2022-03-01 12:28:45 -08:00
Ryan Ernst
400fb28845
Separate launcher tools classpath (#84475)
The tools used in launching Elasticsearch have a separate jar file and
dependencies. This commit moves the launcher tools to its own lib
directory, so that it does not bleed into the main Elasticsearch
classpath.
2022-03-01 07:19:10 -08:00
Nik Everett
3c66958f08
Remove deprecated xcontent method (#84314) (#84372)
This removes one of the `createParser` methods that I deprecated in 
#79814, migrating callers to one of the new methods that it created.
2022-02-28 16:02:09 -05:00
Rory Hunter
fb5b44c522 Restart ES after keystore upgrade in postinst (#84224)
Closes #82433. If the environment variable `RESTART_ON_UPGRADE` is true,
then ensure that we delay restarting Elasticseach until after the
keystore is upgraded, or else we can run into permissions problems.
2022-02-24 09:28:49 +00:00
Andrii Nikitiuk
4d3d0b434c
Removing io.netty.allocator.numDirectArenas override. (#76593)
This flag has already been removed by ES on Oct 21, 2019 after they created their own allocator: 547e399dbf
However, in parallel, on Oct 28, 2019 all command line flags were moved from jvm.options file into the launcher, and this option has been re-introduced: c4fbda3310

See original commit from Oct 21 for the reasoning on why this flag is not needed anymore.
2022-02-22 17:23:54 -07:00
Mayya Sharipova
26c3dd6857
Upgrade to lucene-9.1.0-snapshot-1336263051c (#83667)
Lucene issues that resulted in elasticsearch changes:

LUCENE-9820 Separate logic for reading the BKD index from logic to intersecting it.
LUCENE-10377: Replace 'sortPos' with 'enableSkipping' in SortField.getComparator()
LUCENE-10301: make the test-framework a proper module by moving all test
classes to org.apache.lucene.tests
LUCENE-10300: rewrite how resources are read in ukrainian morfologik analyzer:
LUCENE-10054 Make HnswGraph hierarchical
2022-02-22 09:53:20 +01:00
Rene Groeschke
a86f9c5f02
Remove usage of deprecated Provider#forUseAtConfigurationTime (#83932)
Remove gradle api usage that has been deprecated with Gradle 7.4
2022-02-15 08:06:22 -05:00
Ioannis Kakavas
facec15e87
Upgrade jANSI dependency to 2.4.0 (#83566)
2.4.0 Introduces support for linux and macOS aarch64. Without this
we cannot detect whether a terminal is attached to elasticsearch
on macoOS/linux aarch64 and so we do not generate and print the
elastic password and enrollment token on startup
2022-02-07 11:44:37 +02:00
Albert Zaharovits
035fdd895d
Disable ANSI formatting for security autoconfiguration on Windows cmd line (#83326)
In order to display formatted (bolded) autoconfiguration text on
Windows cmd prompt using JANSI, one needs to invoke the
SetConsoleMode Kernel32 API, via JANSI's AnsiConsole#install.
But we lack the testing infra to properly assert the formatting behavior,
so this PR disables ANSI-formatted output on Windows cmd prompt.

Fixes: #83316
2022-01-31 16:36:02 +02:00
Albert Zaharovits
6687a28e4e
Display security auto-configuration with fancy unicode (#82740)
This PR slightly improves the format of the security auto-configuration
information that is printed on the terminal when the initial cluster
node first starts up.

It uses eye-catching Unicode characters for bullet points.
It also uses Unicode to display a continuous border, for the whole
width of the terminal, before and after the information. In addition,
it uses ANSI escape sequences to render some of the information
in bold fonts.

It will fallback to using regular characters if the JVM is set-up with
a non-UTF encoding for the standard out.
2022-01-25 11:00:37 +02:00
Artem Prigoda
cce5ad2e4f
Migrate to Java16 records (part 2) (#82914)
Try to represent immutable data with Java records introduced in JEP 395

Convert only existing immutable classes, no "POJO with setters to a record" refactorings.
2022-01-25 00:31:15 +01:00
Artem Prigoda
fc5a820da9
Migrate to Java 16 Records (part 1) (#82338)
Try to represent immutable data with Java records introduced in [JEP 395](https://openjdk.java.net/jeps/395)
2022-01-18 17:53:06 +01:00
Rory Hunter
a5afbcd05f
Allow aarch64 ironbank image, fix enrollment test (#82563)
Fixes #81999.

Change `EnrollmentProcessTests` and the testing infrastructure so
that `ServerUtils` can send requests to the correct local port.
This is also a step towards addressing #79688.

Also change the Iron Bank build to that it works on aarch64. This
isn't currently a supported configuration, but it's useful for
testing.
2022-01-13 21:21:59 +00:00
Rory Hunter
d2dbef5063
Convert repository plugins to modules (#81870)
Closes #81652.

Convert the `repository-azure`, `repository-gcs` and `repository-s3`
plugins into modules, so that they are always included in the
Elasticsearch distribution. Also change plugin installation, removal
and syncing so that attempting to add or remove these plugins still
succeeds but is now a no-op.
2022-01-10 10:45:42 +00:00
Artem Prigoda
0699c9351f
Use Java 14 switch expressions (#82178)
JEP 361[https://openjdk.java.net/jeps/361] added support for switch expressions
which can be much more terse and less error-prone than switch statements.

Another useful feature of switch expressions is exhaustiveness: we can make
sure that an enum switch expression covers all the cases at compile time.
2022-01-10 09:53:35 +01:00
Albert Zaharovits
9e9a8cc7d0
Auto-generated TLS files under fixed config path (#81547)
We (mostly I) were initially advocating for the auto-generated files to
use unique names (the name containing a timestamp particle), in order to
avoid that subsequent invocations of the config step conflict with
itself. Moreover, I was wishing that these files will not have to be
handled directly by admins (that the enrollment process was to be used).
However, experience proved us otherwise, admins have to manipulate these
files, and unique configuration names are hard to deal with in scripts
and docs, so this PR is all about using a fixed name for all the
generated files. _Labeling as a bug fix because the feedback is that it
very negatively impacts usabilty._ Closes
https://github.com/elastic/elasticsearch/issues/81057
2021-12-29 12:56:29 -05:00
Rory Hunter
f63ac249d7 Fix Cloud docker image entrypoint generation
For some reason, the way we generate `/app/elasticsearch.sh` for Cloud
images has broken. It may be the result of changing the default shell to
`bash`. Fix by adding `-e` to the `echo` command.
2021-12-17 13:27:32 +00:00
Rory Hunter
4544196c74
Change default shell to bash in default Docker image (#81828)
As a result of changing the base Docker to Ubuntu in #80820, the default shell
i.e. `/bin/sh` changed to `dash`, rather than `bash`, which could impact anyone
invoking `/bin/sh` and expecting it to still propagate environment variables with
periods in their names.

Reconfigure the default shell back to `bash` so that this type of situation works
again.
2021-12-17 09:38:36 +00:00
Artem Prigoda
763d6d510f
Use Java 15 text blocks for JSON and multiline strings (#80751)
The ES code base is quite JSON heavy. It uses a lot of multi-line JSON requests in tests which need to be escaped and concatenated which in turn makes them hard to read. Let's try to leverage Java 15 text blocks for representing them.
2021-12-15 18:01:28 +01:00
Rory Hunter
91b4f6ebdc
Improve Docker image's cacert scripting (#81659)
Apply suggestions from Docker Inc about how to update the `cacerts` in
our Ubuntu-based Docker image. Instead of copying around files and
symlinking, instead install `ca-certificates` and `p11-kit`, and use the
latter to regenerate Java's `cacerts`, as well as ensuring it is
regenerated if the system ca certs are updated.
2021-12-13 15:42:59 -05:00
Rory Hunter
d154989cae Upgrade IronBank base image from 8.4 to 8.5 2021-12-13 19:51:53 +00:00
Mark Vieira
9a3422e1a6
Patch log4j JAR to remove JndiLookup class (#81629) 2021-12-10 15:51:38 -08:00
Chris Hegarty
ef64808caf
Add logging property (#81622) 2021-12-10 16:42:15 +00:00
Ioannis Kakavas
54eb955a65
Docker fix additional nodes (#81082)
Allow users to pass an ENROLLMENT_TOKEN environment variable that
would be passed as the `--enrollment-token` parameter to the
elasticsearch executable running in the container. This allows an
elasticsearch node running in docker to enroll itself to an
existing secured cluster.

Resolves: #81068
2021-12-07 18:10:05 +02:00
Rory Hunter
1f5a0ed2d1
Use Cloudflare's zlib in Docker images (#81245)
Closes #81208. Elasticsearch uses zlib for two purposes:    *
Compression of stored fields with `index.codec: best_compression`,     
which we use for observability and security data.    * Request /
response compression. Historically, zlib was packaged within the JDK, so
that users wouldn't have to have zlib installed for basic usage of Java.
However, the original zlib optimizes for portability and misses a number
of important optimizations such as leveraging vectorization support for
x86 and ARM architectures. Several forks have been created in order to
address this. Since version 9, the JDK uses the system's zlib when
available and falls back to the zlib that is packaged within the JDK if
a system zlib cannot be found. This commit changes the Docker image to
install the Cloudflare fork of zlib, and run Java using the fork instead
of the original zlib, so that users of the Docker image can get better
performance. Other ES distribution types are out-of-scope, since
configuring the JVM to use an alternative zlib requires an environment
config as well as installed another zlib, and Docker is the only
distribution type where we can control both.
2021-12-03 04:48:45 -05:00
Rory Hunter
06304615d4
Check downloaded beats archives (#81222)
Part of #81150. Sometimes, building the Cloud Docker images fails due to
some issue with the `.tar.gz` files. Add extra checks and error messages
so that we have a better idea what the precise problem is.
2021-12-01 20:27:39 +00:00
Chris Hegarty
c16dd35b81
Fix split package between libs/cli and server, move org.elasticsearch.cli to org.elasticsearch.common.cli (#81038)
Fix the split package org.elasticsearch.cli, between server and the cli library. Move the server org.elasticsearch.cli package to org.elasticsearch.common.cli. Removing split packages is a prerequisite to modularization.
2021-11-25 14:42:22 +00:00
Chris Hegarty
e6e812c75f
Allow to set the security manager (#80957)
Post JDK 17 the security manager is disabled by default - setSecurityManager throws UOE - see JEP 411.

This change adds a command line option to explicitly allow to set the security manager, which enables early testing with releases greater than JDK 17.
2021-11-24 09:51:13 +00:00
Rory Hunter
7db06c110b
Fix shadowed vars pt6 (#80899)
Part of #19752. Fix more instances where local variable names were shadowing field names.
2021-11-23 09:51:09 +00:00
Rory Hunter
4cb6fb925e
Install wget in Cloud Docker images (#80870)
Cloud needs wget to be available in 8.x, so add it to their Docker images.
2021-11-19 19:51:38 +00:00
Rory Hunter
7ec32669f6
Switch to Ubuntu docker base image (#80640)
Switch the ES base Docker image for the default and Cloud images to `ubuntu:20.04`,
as Ubuntu has a more favourable posture on security updates.
2021-11-18 10:10:36 +00:00
Rory Hunter
3018e52335
Introduce declarative plugin management (#77544)
Closes #70219.

Introduce a declarative way for the Elasticsearch server to manage plugins,
which reads the `elasticsearch-plugins.yml` file and works which out
plugins need to be added and / or removed to match the configuration. Also
make it possible to configure a proxy in the config file, instead of
through the environment.

Most of the work of adding and removing is still done in the
`InstallPluginAction` and `RemovePluginAction` classes, so the
behaviour should be the same as with the `install` and `remove`
commands. However, these commands will now abort if the above config
file exists. The intent is to make it harder for the configuration
to drift.

This new method only applies to `docker` distribution types at the
moment.

Since this syncing mechanism declarative, rather than imperative,
the Cloud-specific plugin wrapper script is no longer required.
Instead, an environment variable informs `InstallPluginAction` to
install plugins from an archive directory instead of downloading
them, where possible.
2021-11-15 14:41:11 +00:00