Commit graph

1388 commits

Author SHA1 Message Date
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
Przemyslaw Gomulka
3e804bdadb
Initialise ES logging in CLI (#97353)
ES logging has to be explicitly initialised with a call to LoggerFactory.setInstance This is normally done as LogConfigurator.configure(Environment,boolean) is calling this as part of initPhase1

However CLI tools were not using that method. Cli tools are using LogConfigurator.configureWithoutConfig and that method was not setting up ES logging

This commit modifies configureWithoutConfig to also configure esLogging It also adds a LogConfigurator.configureESLogging call explicitly in CliToolLauncher This allows to build a new cli-launcher.jar and replace it in previous 8.7-8.9 clusters

closes #97350
2023-07-04 16:49:07 +02:00
Rene Groeschke
b8627079b4
Update Gradle Wrapper to 8.2 (#96686)
- Convention usage has been deprecated and was fixed in our build files
- Fix test dependencies and deprecation
2023-07-04 15:35:15 +02:00
Armin Braun
63e64ae61b
Cleanup Stream usage in various spots (#97306)
Lots of spots where we did weird things around streams like redundant stream creation, redundant collecting
before adding all the collected elements to another collection or so, redundant streams for joining strings
and using less efficient `Collectors.toList` and in a few cases also incorrectly relying on the result being mutable.
2023-07-03 14:24:57 +02:00
Chris Hegarty
f59035eb7b
Update plugin cli/scanner to ASM 9.5 (#97296)
This commit updates the plugin cli and scanner components to use ASM 9.5.

The update is required to successfully test with JDK 21. Tests in this component programatically run the java source compiler, which generates class files with major version 65, then tries to parse those generated class files. Without this change the tests fail with java.lang.IllegalArgumentException: Unsupported class file major version 65.
2023-07-01 20:29:10 +01:00
Craig Taverner
0d53beea4f
Fix test after 'Add exit code to CLI failure termination message' (#97010)
* Error output changed, so we change the test

* More tests failing for the same reason
2023-06-22 16:28:08 +02:00
Chris Hegarty
d1d7aea720
Bump minimum targetCompatibility of java version checker to 1.8
Bump the minimum targetCompatibility of java version checker to 1.8 ( from 1.7 ).

JDK 20 has removed support for source and target 1.7 in javac [1], so to successfully build with JDK 20 (through JAVA_TOOLCHAIN_HOME), we can no longer specify targetCompatibility = JavaVersion.VERSION_1_7, for the java version checker.

The idea of the java version checker is to successfully run with "older" JDK's, but I think that 1.8 is presently more than sufficient. While we still don't "support" compiling with JDK 20, it is good to keep the project up to date, so we can more easily experiment with recent JDK's.
2023-06-08 09:58:17 +01:00
David Turner
c5e519dcd8
Remove unnecessary != false idioms (#96654) 2023-06-07 10:12:51 -04:00
Chris Hegarty
9a89ea7405
Enable the Panama Vector module (#96453)
This change adds the jdk.incubator.vector module, so that we can enable the Panamaized vector utils in Lucene.

The module is added by default if running on JDK 20, which is the only current supported implementation in Lucene, but JDK 21 will likely come soon.

If for some reason this needs to be disable, just remove or otherwise comment out the --add-modules=jdk.incubator.vector line in the jvm.options.

The log output from Lucene shows the preferred vector bit width that is in operation.
2023-06-02 00:09:03 +01:00
Rene Groeschke
cc2a711b2d
Always use es tarball for creating IronBank docker context (#95958)
This fixes an issue with building iron bank images that are handled differently
than other docker images.
2023-05-09 17:39:35 +02:00
Rene Groeschke
778adc8622
Make es docker image creation more efficient (#95883)
We want avoid packing and unpacking elasticsearch archives to safe build time
2023-05-08 18:20:10 +02:00
Michael Montgomery
a0056941e5
Use UID for dockerfile to allow runAsNonRoot to be used. (#95390)
Signed-off-by: Michael Montgomery <mmontg1@gmail.com>
2023-04-19 12:26:26 -07:00
Ryan Ernst
c619be4b5e
Move preallocate module to libs (#94884)
The preallocate module needs access to java.io internals. However, in
order to open java.io to a specific module, rather than the unnamed
module as was previously done, the said module must be in the boot
layer.

This commit moves the preallocate module to libs. It adds it to the main
lib dir, though it does not add it as a compile dependency of server.
2023-04-10 13:05:43 -07:00
Rory Hunter
fe1083f6c5
Upgrade spotless plugin to 6.17.0 (#94994)
Fixes #82794. Upgrade the spotless plugin, which addresses the issue
around formatting `instanceof` expressions. Formatting of statements
including lambdas seems to have improved too.
2023-04-04 10:03:32 +01:00
Rene Groeschke
e735455431
Provide hints to Gradle Task.onlyIf declarations (#94953)
* Update gradle enterprise plugin to show skip reasons in build scans
* Unify OS specific handling in build logic
2023-03-31 23:57:55 +02:00
Ryan Ernst
9e7648abc4
Change java.io opens to new preallocate module (#94757)
With the modularization of preallocate, the opens command line can be
changed to only open to this module instead of all unnamed.
2023-03-27 11:55:22 -07:00
Mark Vieira
315fa321ae
Improve efficiency of packer cache script (#94701) 2023-03-23 13:29:45 -07:00
Rene Groeschke
9ce5baed0c
Update Gradle wrapper to 8.0.2 (#92751)
- Remove custom checksum build logic in wrapper task
- Adjust jdk home handling adjusting the change in behaviour in gradle. Requires providing canonical paths for provisioned jdk homes.
- Fix test by add workaround to bug in configuration cache
2023-03-09 13:00:12 +01:00
Nikola Grcevski
a849480aef
Upgrade asm to 9.4 to support Java20 (#93530) 2023-02-06 14:18:30 -05:00
Nikolaj Volgushev
a0343e4c57
Make password long enough for FIPS mode (#93450)
In FIPS mode, passwords require a minimal length. This PR adjusts a
test to adhere to this.

Fixes: #93449
2023-02-02 15:03:11 +01:00
Nikola Grcevski
5b67fd26cf
[TEST] Fix servercli tests for FIPS mode (#93350) 2023-02-01 10:37:38 -05:00
David Turner
fe50f38016
Add ActionListener#run (#93338)
It's pretty common to run a block of code in a `try ... catch` block
that just passes exceptions off to a listener's `onFailure` method. This
commit adds a small utility to encapsulate this, enabling some
one-liners.
2023-01-31 07:02:44 +00:00
David Turner
2cf70ae5e8
Fix some possible NPEs in strange JVM configs (#93352)
`JvmErgonomics` requires various JVM options to be present, but if they
are omitted then we throw a `NullPointerException` which looks to the
user like an ES bug. They would have to be doing something a little odd
to get into this state, but nonetheless it is possible to hit these
NPEs. We don't need to handle such a config gracefully, but we should
clarify why Elasticsearch won't start to help the user fix their config.
2023-01-30 13:24:55 -05:00
Nikolaj Volgushev
2a6e52134c
Mute o.e.s.c.ServerCliTests (#93349)
Relates: #93335

Skipping via assumeFalse since the failures only occur in FIPS mode.
2023-01-30 16:39:40 +01:00