Commit graph

1311 commits

Author SHA1 Message Date
Ryan Ernst
e9ca58589b
Standardize build distribution internals on os/architecture (#105842) (#105846)
The build handles platform specific code which may be for arm or x86.
Yet there are multiple ways to describe 64bit x86, and the build
converts between the two in several places. This commit consolidates on
the x64 nomenclature in most places, except where necessary (eg ML still
uses x86_64).

relates #105715
2024-02-28 17:08:42 -05:00
Ryan Ernst
6375e9f443
Add native access library (#105100)
Elasticsearch requires access to some native functions. Historically
this has been achieved with the JNA library. However, JNA is a
complicated, magical library, and has caused various problems booting
Elasticsearch over the years. The new Java Foreign Function and Memory
API allows access to call native functions directly from Java. It also
has the advantage of tight integration with hotspot which can improve
performance of these functions (though performance of Elasticsearch's
native calls has never been much of an issue since they are mostly at
boot time).

This commit adds a new native lib that is internal to Elasticsearch. It
is built to use the foreign function api starting with Java 21, and
continue using JNA with Java versions below that.

Only one function, checking whether Elasticsearch is running as root, is
migrated. Future changes will migrate other native functions.
2024-02-07 18:27:09 -05:00
Ryan Ernst
2a298a7acc
Add replay diagnostic dir to system jvm options (#103535)
When hotspot encounters an error, it will emite a log file which can be
used for reproducing the error. This file is dumped to /tmp by default.
This commit configures the replay file to be alongside the hs_err file.
2024-02-05 20:58:53 -08:00
Ryan Ernst
125c1c86af
Fix server cli to always pass through exit code (#104943)
In certain circumstances if Elasticsearch encounters an error while
starting up, the server cli may exit with no error. This commit fixes
the cli to always check and wait on the Elasticsearch process and exit
with the same exit code.

relates #104055
2024-01-31 12:28:09 -05:00
Moritz Mack
dbf59c5414
Update/Cleanup references to old tracing.apm.* legacy settings in favor of the telemetry.* settings (#104917) 2024-01-31 09:20:05 +01:00
Moritz Mack
35cc9e1159
New APM settings using telemetry. prefix deprecate ambiguous tracing.apm. settings. (#104376)
Telemetry / APM settings are renamed from "tracing.apm.{name}" to "telemetry.tracing.{name}" for tracing related settings. General APM settings are renamed to "telemetry.{name}". The old legacy settings are kept for now and applied as fallback.
2024-01-30 09:34:03 +01:00
Rene Groeschke
077d8be599
Fix typo in BuildParams.isCi() usage (#104812) 2024-01-26 09:24:12 -05:00
Rene Groeschke
ab8ee60bba
Fix SamlAuthenticationIT flakyness (#103867) 2024-01-24 13:44:31 -05:00
Stuart Tettemer
3493e425ac
Metrics: Agent settings prefix telemetry.agent preferred over tracing.apm.agent (#104345)
Prefer the telemetry.agent prefix for APM agent settings.

Add a fallback prefix to Affix settings to migrating between an old prefix
and a new prefix.
2024-01-22 12:53:36 -06:00
Moritz Mack
00ca64bcf2
Use allow-list for APM agent settings and consolidate defaults in APMJvmOptions (#104141)
Prevent invalid and miss-configuration of APM agent using an explicit allow-list of setting keys.
Additionally, configuration defaults of APMAgentSettings are consolidated in APMJvmOptions to keep defaults in a single location.
(ES-6916)
2024-01-12 10:30:04 +01:00
Ryan Ernst
2f5247117e
Upgrade ASM to 9.6 for Java 22 support (#104085)
This commit upgrades the version of asm used by the build and plugins in
order to support Java 22 version format.

closes #104065 relates #103963
2024-01-08 15:03:40 -05:00
Chris Hegarty
3f0a3dce66
Upgrade to Lucene 9.9.1 (#103387)
This commit upgrades to Lucene 9.9.1.

With the upgrade to 9.9.1 we can now remove the compiler excludes added by #103112.
2023-12-19 09:27:19 +00:00
Armin Braun
49f1b5b787
Make sure to close XContentParser in more spots (#103504)
We're leaking quite a few of these parsers. That doesn't seem to be much
of a problem but results in some memory inefficiencies in Jackson here
and there. This PR bulk fixes a bunch of instances that I could easily
automatically fix. I'll open a follow-up for closing the parser on the
document parsing context which also suffers from this but is non-trivial
to fix.
2023-12-19 10:26:06 +01:00
Lorenzo Dematté
0e5f485058
ServerProcess refactoring (separate options construction from ServerProcess start) (#102973)
* Refactoring: move command line and environment build to a separate class
* Refactoring: adding a builder
* Moving tmp dir setup and JVM option parsing outside of builder
2023-12-14 07:37:50 +01:00
Chris Hegarty
b510e59c67
Add JIT compiler excludes for computeCommonPrefixLengthAndBuildHistogram (#103112)
This commit adds a temporary JIT compile command that excludes the compilation of a couple of Lucene methods which, if compiled, crash the JVM.
2023-12-07 16:02:53 +00:00
Jon
c0bfab9338
Update IronBank docker image base to ubi:9.3 (#102721) 2023-12-06 10:18:47 -08:00
Lorenzo Dematté
c54ce68723
Switch InstallPluginActionTests to non-blocking SecureRandom seed generator (#102893)
* Force urandom on Linux
* Unmute test
2023-12-04 18:54:38 +01:00
Jon
6787765c37
Update IronBank BASE_IMAGE with ironbank prefix (#102720)
This supports local testing.  It should not be included in
hardening_manifest.yml, which injects the scope at runtime.
2023-11-30 13:47:33 -08:00
Rene Groeschke
98b9bd547a
Mute tests (#102785) 2023-11-30 13:16:35 +01:00
Lorenzo Dematté
e86f0f78ab
Adding extension point in ServerCli to add processing after server process exited (#102475) 2023-11-28 09:47:05 +01:00
Armin Braun
1b84ea7421
Delete all unused private methods (#98111)
Pretty straight forward dead-code cleanup I think. Just delete all
private methods or methods in private classes that aren't used.
2023-11-25 22:21:59 +01:00
Jake Landis
17a46a6e9f
upgrade bouncy castle jars (#100923)
This commit upgrades the Bouncy Castle jars. Bouncy Castle is used for 
some internal build concners as well as a comnand line application. 
Most notably Bouncy Castle is also used as the FIPs certified JCE/JSEE provider 
we use to test our ability to use a FIPs compliant crypto provider. 

The following changes here are a result of the upgraded Bouncy Castle jars:
* TLSv1.3 is now supported when running in FIPs mode 
* RSA PKCS#1 v1.5 is no longer allowed in FIPS mode
* Triple DES (3DES) is no longer allowed in FIPS mode
* Minor updates the security manager configuration used to test FIPs (to read permissions from the security provider)
* Minor adjustments to tests to accommodate the above changes. 
* Minor adjustments to the gradle build to accommodate new dependencies 

Note - update to the documentation will come in a later commit.
2023-11-21 11:14:41 -06:00
Mark Vieira
5d379626df
Expose historical feature metadata to rest tests (#102110)
This introduces a new getHistoricalFeatures() method on ESRestTestCase
which returns a map of historical feature version mappings loaded from
FeatureSpecification implementations from any plugins/modules in use
by the current test suite. The mappings are generated by a new Gradle
task at build time, and then injected into the test runtime as a
System property.
2023-11-14 10:38:33 -08:00
Przemyslaw Gomulka
4581f654ab
Rename apm-agent.log to .json (#102158)
those logs are in json, so for consistency with other log files
should be ending with .json
2023-11-14 17:58:57 +01:00
Rene Groeschke
aa48860fac
Make YamlRestTest and ElasticDistributionPlugin cc compatible (#101923)
* Make YamlRestTest and ElasticDistributionPlugin cc compatible

These changes are addressing configuration cache incompatibilities of running
rest tests with the new ClassRule based Elasticsearch test cluster setup.

This allows running those tests with configuration cache enabled:
`./gradlew :modules:ingest-user-info:yamlRestTest --configuration-cache`
2023-11-10 08:02:53 +01:00
Ryan Ernst
e787a28ab7
Set ActiveProcessorCount when node.processors is set (#101846)
node.processors determines the size of Elasticsearch threadpools. This
commit sets the JDK flag -XX:ActiveProcessorCount when node.processors
is set so that the JDK similarly sizes its threadpools accordingly.

relates #100244
2023-11-07 07:22:56 -05:00
Rene Groeschke
4fa18ff42b
Make forbidden apis check cacheable and cc compatible (#101217)
* Make forbidden apis check cacheable and cc compatible
* Port CheckForbiddenApiTask to use worker api
* Simplify runtime classpath for CheckForbiddenApisTask
2023-11-01 16:24:28 +01:00
Ryan Ernst
d0064250ad
Forbid non-named threads (#101631)
This commit forbids the use of Thread constructors that do not take a
name. In general nameless threads are more difficult to understand their
purpose when debugging. Note that this is only added to production
signatures. Tests are not forbidden here so as not to be pedantic (or
require a larger change since many tests create anonymous threads).

relates #101628
2023-10-31 15:18:32 -07:00
Mark Vieira
328ebc4145
Update IronBank docker image base to ubi:9.2 (#101393) 2023-10-26 11:29:44 -07:00
Ryan Ernst
d0571b6c22
Cleanup apm logging config (#101291)
This commit makes the apm log a little more usable. First, it makes the
path to the log explicit by passing the ES logs dir through, instead of
relying on the location of the apm jar file. Second, it tweaks the log
level to be warn, not error. Third, it switches the apm log file to be
json, which is more easily processable.
2023-10-25 18:15:19 -04:00
Ryan Ernst
32c50dc058
Separate version qualifier from version in build (#100868)
The build version is made up of a few parts in non-release builds. Both
the snapshot and pre-release qualifiers are appended to it. These
qualifiers used to be part of Version, but in 7.0 the qualifiers were
made to be found only in the build info. The Build class retains these
qualifiers through the compile ES version extracted from the server jar
at runtime.

Build.qualifiedVersion() is suppose to provide the fully qualified
version, including snapshot and pre-release qualifiers. Yet
Build.version() also includes this information; there is no distinction
since the qualifier was moved to be only in the build info.

This commit separates the pre-release qualifier from the version. It
maintains bwc in talking to older nodes, passing the fully qualified
version there, but in current nodes splits out the pre-release qualifier
into a new member of Build.
2023-10-16 20:23:03 -07:00
William Brafford
14263a78e8
Remove uses of Version from Plugin CLI commands (#100298)
The Plugin CLI can generally treat strings opaquely. We had some logic 
comparing earlier versions, but what we really care about with most of our 
plugins is whether or not they were built with the current version of 
Elasticsearch, not whether they were built before or after. (This question 
will be trickier with stable plugins, but none of that code is in the CLI.)

The CLI classes can be cleaned up even more once Version is removed from 
PluginDescriptor. Some of the tests can't use opaque strings for versions 
until PluginDescriptor can handle them.

* Remove Version from Install and List plugin actions
* Remove Version from SyncPluginsAction
2023-10-11 08:49:18 -04:00
Nik Everett
d2fa1ee4f1
ESQL: Don't log the parse tree (#100545)
ESQL would log the antlr parse tree of it statements. These are kind of
unreadable:
```
{"@timestamp":"2023-10-09T15:13:43.921Z", "log.level":"DEBUG", "message":"Parse tree: ([] ([94] ([2 94] ([2 2 94] ([2 2 2 94] ([2 2 2 2 94] ([2 2 2 2 2 94] ([2 2 2 2 2 2 94] ([98 2 2 2 2 2 2 94] ([109 98 2 2 2 2 2 2 94] from ([256 109 98 2 2 2 2 2 2 94] employees)))) | ([102 2 2 2 2 2 94] ([118 102 2 2 2 2 2 94] sort ([364 118 102 2 2 2 2 2 94] ([372 364 118 102 2 2 2 2 2 94] ([135 372 364 118 102 2 2 2 2 2 94] ([189 135 372 364 118 102 2 2 2 2 2 94] ([197 189 135 372 364 118 102 2 2 2 2 2 94] ([214 197 189 135 372 364 118 102 2 2 2 2 2 94] ([306 214 197 189 135 372 364 118 102 2 2 2 2 2 94] emp_no)))))))))) | ([102 2 2 2 2 94] ([120 102 2 2 2 2 94] where ([130 120 102 2 2 2 2 94] ([135 130 120 102 2 2 2 2 94] ([190 135 130 120 102 2 2 2 2 94] ([197 190 135 130 120 102 2 2 2 2 94] ([215 197 190 135 130 120 102 2 2 2 2 94] ([222 215 197 190 135 130 120 102 2 2 2 2 94] mv_count) ( ([225 215 197 190 135 130 120 102 2 2 2 2 94] ([135 225 215 197 190 135 130 120 102 2 2 2 2 94] ([189 135 225 215 197 190 135 130 120 102 2 2 2 2 94] ([197 189 135 225 215 197 190 135 130 120 102 2 2 2 2 94] ([214 197 189 135 225 215 197 190 135 130 120 102 2 2 2 2 94] ([306 214 197 189 135 225 215 197 190 135 130 120 102 2 2 2 2 94] job_positions)))))) )))) ([191 135 130 120 102 2 2 2 2 94] <=) ([192 135 130 120 102 2 2 2 2 94] ([197 192 135 130 120 102 2 2 2 2 94] ([213 197 192 135 130 120 102 2 2 2 2 94] ([321 213 197 192 135 130 120 102 2 2 2 2 94] 1))))))))) | ([102 2 2 2 94] ([120 102 2 2 2 94] where ([130 120 102 2 2 2 94] ([135 130 120 102 2 2 2 94] ([190 135 130 120 102 2 2 2 94] ([197 190 135 130 120 102 2 2 2 94] ([214 197 190 135 130 120 102 2 2 2 94] ([306 214 197 190 135 130 120 102 2 2 2 94] emp_no)))) ([191 135 130 120 102 2 2 2 94] >=) ([192 135 130 120 102 2 2 2 94] ([197 192 135 130 120 102 2 2 2 94] ([213 197 192 135 130 120 102 2 2 2 94] ([321 213 197 192 135 130 120 102 2 2 2 94] 10024))))))))) | ([102 2 2 94] ([116 102 2 2 94] limit 3))) | ([102 2 94] ([117 102 2 94] keep ([381 117 102 2 94] emp_no) , ([383 117 102 2 94] job_positions)))) | ([102 94] ([114 102 94] eval ([280 114 102 94] ([240 280 114 102 94] ([249 240 280 114 102 94] ([306 249 240 280 114 102 94] is_in)) = ([251 240 280 114 102 94] ([137 251 240 280 114 102 94] ([189 137 251 240 280 114 102 94] ([197 189 137 251 240 280 114 102 94] ([214 197 189 137 251 240 280 114 102 94] ([306 214 197 189 137 251 240 280 114 102 94] job_positions))))) in ( ([143 251 240 280 114 102 94] ([189 143 251 240 280 114 102 94] ([197 189 143 251 240 280 114 102 94] ([213 197 189 143 251 240 280 114 102 94] ([324 213 197 189 143 251 240 280 114 102 94] \"Accountant\"))))) , ([145 251 240 280 114 102 94] ([189 145 251 240 280 114 102 94] ([197 189 145 251 240 280 114 102 94] ([213 197 189 145 251 240 280 114 102 94] ([324 213 197 189 145 251 240 280 114 102 94] \"Internship\"))))) , ([145 251 240 280 114 102 94] ([189 145 251 240 280 114 102 94] ([197 189 145 251 240 280 114 102 94] ([213 197 189 145 251 240 280 114 102 94] null)))) ))))))) <EOF>)", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[javaRestTest-0][esql][T#8]","log.logger":"org.elasticsearch.xpack.esql.parser.EsqlParser","elasticsearch.cluster.uuid":"CqmNvJFtTdWUGNY9m-7ccw","elasticsearch.node.id":"njbEEK7jTqiZned-iIMKuQ","elasticsearch.node.name":"javaRestTest-0","elasticsearch.cluster.name":"javaRestTest"}
```

See? That's useful if you are debugging ANTLR, but unless you really
need it it's kind of in the way. And, if the query is really big, it's
like an 80mb single line string. Oooof. Bad times.

So! This moves that log from `debug` to `trace` and turn off trace level
logging in esql. Which I'd left on accidentally a long while back.
2023-10-09 16:27:52 -04:00
Armin Braun
b7eafce32c
Make some practically static methods static (#97565)
Another round of automated fixes to this, marking things that can be
made static as static. Saves some JIT cycles but also turns some lambdas
from capturing to non-capturing and makes the "utilityness" of some
classes visible.
2023-10-06 23:37:07 +02:00
Rene Groeschke
69d87e1bfd
Rework beats artifacts resolution in docker build (#100157)
* Rework metricbeat artifacts resolution to avoid misleading error message
* Pass File object to beats repo uri to workaround parsing problems
2023-10-06 17:04:46 +02:00
Rene Groeschke
d214d74000
Use patched nebula os package gradle plugin (#100280)
There is a bug in the nebula os package gradle plugin that breaks copy spec specific setgid handling.
We have created a patch for the plugin that we use for now to unblock us. This will be ported upstream
to the nebula main branch and part of a release but that requires some more polishing and will
be taken care of in a later PR
2023-10-05 07:59:10 +02:00
Nik Everett
9620512a89
ESQL: Tests for large concat and many evals (#100159) 2023-10-03 14:41:40 -04:00
Lorenzo Dematté
cc572fd92d
Moved APM service version from Version to Build.version() (#100084) 2023-10-02 12:12:35 +02:00
Przemyslaw Gomulka
b856bf264d
Update the elastic-apm-agent version (#100064)
The latest version contains a fix to allow sending metrics to APM server. also adds a apm agent jvm options
"enable_experimental_instrumentations", "true"
which is required to enable the otel-metrics-instrumentation.

relates https://github.com/elastic/elasticsearch/pull/99832
2023-09-29 14:35:04 -05:00
Rene Groeschke
8fd2a49321
Explicitly configure setgid for RPM and Dep packaging (#100063)
Fixes CI issue: https://github.com/elastic/elasticsearch/issues/99972

Ran packaging tests as part of this PR:

 https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+pull-request+packaging-tests-unix-sample/44772/
2023-09-29 17:48:34 +02:00
Lorenzo Dematté
a6b651a138
Replace Version.CURRENT toString usages with Build.current() equivalents (#99870)
* Replaced some occurrences of Version.CURRENT toString
* Added unit tests for the 2 different warn header patterns in HeaderWarnings
* Comment to clarify non-semantic versions + revert change on Version.major message
2023-09-27 09:42:35 +02:00
Rene Groeschke
b23e000c30
Update gradle wrapper to 8.3 (#97838)
Gradle now fully supports compiling, testing and running on Java 20. 
Among other general performance improvements this release introduces --test-dry-run command line option that allows checking if tests are filtered or not by gradle.
Required updating nebula ospackage plugin as setuid was broken in gradle 8.3.
2023-09-27 08:48:21 +02:00
Chris Hegarty
ccdd85f784
Update version range in jvm.options for the Panama Vector API (#99846)
This commit updates the version range in jvm.options for the Panama Vector API. The range is updated from just a single value 20, to a range starting from 20 with no upper bound. This effectively enables the Panama Vector API for use in Lucene on all JDK versions greater than 19.
2023-09-23 23:01:47 +01:00
Przemyslaw Gomulka
0efa67821d
Rename TracerPlugin to TelemetryPlugin (#99735)
with the support of metrics the TracerPlugin name is no longer adequate. Renaming this to TelemetryPlugin.
Also introducing TelemetryProvider interface. While it is only used in Node.java at the moment to fetch Tracer instance, it is intended to be used in Plugin::createComponents (to be done in separate commit due to
the broad scope of this method)
This will allow for plugins to get access to both Tracer and Metric interfaces
without the need to add yet another argument to createComponents

Also adding internal subpackage in module/apm so that it is more obvious
which packages are not exported
2023-09-22 13:35:36 +02:00
Jake Landis
f3aa254b55
Bump version for commons-compress (#99633)
This commit bumps the version for commons-compress to 1.24.0.
2023-09-18 14:03:59 -05:00
Brian Seeders
0ec47aa4f7
Set explicit file permissions in NoticeTask (#99206) 2023-09-05 18:16:56 -04:00
Ryan Ernst
9caee77cdc
Include all modules in module path in module graph (#98757)
Elasticsearch use lib as its module path, which includes all the
dependencies of server. However, there are sometimes additional modules
such as preallocate that are used dynamically and not direct
dependencies of server. This commit switches the addition of these
modules to be automatic by including all modules present in the module
path.
2023-08-23 06:22:22 -07:00
Brian Seeders
81e1fd2f1b
Add java-matrix and java-fips-matrix Buildkite pipelines (#97253) 2023-07-28 14:49:46 -04:00
Simon Cooper
5c493d7dc5
Remove some uses of getMinimumIndexCompatibilityVersion (#97390) 2023-07-27 10:22:51 +01:00
Ryan Ernst
568b292bde
Encapsulate current Build (#97292)
In order for build info to be pluggable for serverless, the current
build needs to be lazily determined. This commit moves the CURRENT
constant to a static method.

relates #96861
2023-07-06 11:38:54 -07:00