Commit graph

741 commits

Author SHA1 Message Date
Rene Groeschke
0e82176644
[8.16] Update Gradle wrapper to 8.13 (#122421) (#123876)
* Update Gradle wrapper to 8.13 (#122421)

* Fix Gradle Deprecation warning as declaring an is- property with a Boolean type has been deprecated.
* Make use of new layout.settingsFolder api to address some cross project references
* Fix buildParams snapshot check for multiprojet projects

(cherry picked from commit e19b2264af)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BaseInternalPluginBuildPlugin.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java
#	docs/build.gradle
#	qa/lucene-index-compatibility/build.gradle
#	x-pack/qa/multi-project/core-rest-tests-with-multiple-projects/build.gradle
#	x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/build.gradle

* More fixes
2025-03-06 02:08:55 +11:00
Rene Groeschke
4d17b2193a
Update Gradle wrapper to 8.12 (#118683) (#119357)
This updates the gradle wrapper to 8.12

We addressed deprecation warnings due to the update that includes:

- Fix change in TestOutputEvent api
- Fix deprecation in groovy syntax
- Use latest ospackage plugin containing our fix
- Remove project usages at execution time
- Fix deprecated project references in repository-old-versions

(cherry picked from commit ba61f8c7f7)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/DockerCloudElasticsearchDistributionType.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/DockerUbiElasticsearchDistributionType.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/Fixture.java
#	plugins/repository-hdfs/hadoop-client-api/build.gradle
#	server/src/main/java/org/elasticsearch/inference/ChunkingOptions.java
#	x-pack/plugin/kql/build.gradle
#	x-pack/plugin/migrate/build.gradle
#	x-pack/plugin/security/qa/security-basic/build.gradle
2024-12-31 08:37:28 +01:00
Rene Groeschke
c158859921
[8.16] Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300) (#119325) (#119338)
* Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300) (#119325)

* Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300)

The original PR (#118894) has broken serverless.

* Fix gitinfo plugin for serverless usage

* Update buildscan git revision reference

(cherry picked from commit 5278159987)

# Conflicts:
#	build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/PublishPlugin.java

* Fix merge conflict
2024-12-30 15:31:36 +01:00
Chris Hegarty
129645628d Improve logging of native vector scorer - vec_caps (#118325) (#118356)
This commit adds logging of the system's vector capability check, to help with diagnosing whether AVX2 or AVX 512 will be used.
2024-12-11 10:59:10 +00:00
Rene Groeschke
581b9ab7c0
[8.16] [Gradle] Remove static use of BuildParams (#115122) (#117434)
* [Gradle] Remove static use of BuildParams (#115122)

Static fields dont do well in Gradle with configuration cache enabled.

- Use buildParams extension in build scripts
- Keep BuildParams.ci for now for easy serverless migration
-  Tweak testing doc

(cherry picked from commit 13c8aaeffa)

# Conflicts:
#	TESTING.asciidoc
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java
#	build.gradle
#	modules/ingest-geoip/qa/full-cluster-restart/build.gradle
#	qa/mixed-cluster/build.gradle
#	x-pack/plugin/ent-search/qa/full-cluster-restart/build.gradle
#	x-pack/plugin/eql/qa/rest/build.gradle
#	x-pack/plugin/fleet/qa/rest/build.gradle
#	x-pack/plugin/kql/build.gradle
#	x-pack/plugin/mapper-unsigned-long/build.gradle
#	x-pack/plugin/ml/qa/multi-cluster-tests-with-security/build.gradle
#	x-pack/plugin/security/qa/multi-cluster/build.gradle
#	x-pack/plugin/sql/qa/jdbc/build.gradle
#	x-pack/plugin/transform/qa/multi-cluster-tests-with-security/build.gradle

* Fix merge

* [Build] Fix fips testing after buildparams rework (#116934)

* More Cleanup

* [Build] Fix checkstyle exclusions on windows (#115185)

* More merge fixes

* Delete x-pack/plugin/kql/build.gradle
2024-11-27 12:34:32 +01:00
Carlos Delgado
26e8a7602a
Do not exclude empty arrays or empty objects in source filtering with Jackson streaming (#112250) (#115223)
(cherry picked from commit 6be3036c01)

Co-authored-by: mccheah <mcheah@palantir.com>
2024-10-21 16:29:16 +02:00
David Turner
98209e44de
Simplify XContent output of epoch times (#114491) (#114736)
Today the overloads of `XContentBuilder#timeField` do two rather
different things: one formats an object as a `String` representation of
a time (where the object is either an unambiguous time object or else a
`long`) and the other formats only a `long` as one or two fields
depending on the `?human` flag.

This is trappy in a number of ways:

- `long` means an absolute (epoch) time, but sometimes folks will
  mistakenly use this for time intervals too.

- `long` means only milliseconds, there is no facility to specify a
  different unit.

- the dependence on the `?human` flag in exactly one of the overloads is
  kinda weird.

This commit removes the confusion by dropping support for considering a
`Long` as a valid representation of a time at all, and instead requiring
callers to either convert it into a proper time object or else call a
method that is explicitly expecting an epoch time in milliseconds.
2024-10-15 03:46:31 +11:00
Simon Cooper
c1115d24d7
Add a size limit to outputs from mustache (#114002) (#114297)
Backport #114002 to 8.16
2024-10-08 12:47:08 +01:00
Chris Hegarty
c84471a838
[8.x] Allow incubating Panama Vector in simdvec, and add vectorized ipByteBin (#114245)
* Allow incubating Panama Vector in simdvec, and add vectorized ipByteBin (#112933)

Add support for vectorized ipByteBin.

The structure of the implementation and loading framework mirror that of Lucene, but is simplified by avoiding reflective loading since ES has support for a MRJar section for 21.

For now, we just disable warnings-as-errors in this small sourceset, since -Xlint:-incubating is only support since JDK 22. The number of source files is small here. Will investigate how to assert that just the single incubating warning is emitted by javac, at a later point.

* fix build runtime java check

* Fix Gradle configuration in idea for :libs:simdvec (#114251)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Rene Groeschke <rene@elastic.co>
2024-10-08 07:03:17 +11:00
Ignacio Vera
f0f8cb4493
Make H3 CellBoundary immutable (#113792) (#114204)
Small refactor that makes CellBoundary immutable.
2024-10-07 20:42:16 +11:00
Iván Cea Fontenla
298984048b
[8.x] Add CircuitBreaker to TDigest, Step 4: Take into account shallow classes size (#114028)
* Add CircuitBreaker to TDigest, Step 4: Take into account shallow classes size (#113613)

* Removed muted tests from merge conflict

* Added missing empty line in muted tests
2024-10-04 01:34:22 +10:00
David Turner
9b341b139d
Mark AbstractRefCounted#mustIncRef as final (#113761) (#113932)
The overridden `RefCounted` methods on `AbstractRefCounted` are all
`final`, but `mustIncRef` uses the default implementation and can still
be overridden. For the avoidance of doubt, this commit marks
`mustIncRef` as `final`.
2024-10-03 20:58:58 +10:00
Chris Hegarty
45a08b94b3
Upgrade to Lucene 9.12.0 (#113333) (#113835)
This commit upgrades to Lucene 9.12.0.

Co-authored-by: Adrien Grand <jpountz@gmail.com>
Co-authored-by: Armin Braun <me@obrown.io>
Co-authored-by: Benjamin Trent <ben.w.trent@gmail.com>
Co-authored-by: John Wagster <john.wagster@elastic.co>
Co-authored-by: Luca Cavanna <javanna@apache.org>
Co-authored-by: Mayya Sharipova <mayya.sharipova@elastic.co>
2024-10-01 13:55:02 +01:00
Ignacio Vera
bd5f989f3e
Revert "Protect H3 library against integer overflow #92829" (#113773) (#113782)
This library has well defined inputs and outputs so protecting against overflow is not necessary and it introduces a 
significant overhead.
2024-09-30 21:07:13 +10:00
Ignacio Vera
c5a4792925
convert some H3 classes to records (#113574) (#113772) 2024-09-30 20:05:52 +10:00
Ryan Ernst
8b795d4048
Remove plugin classloader indirection (#113154) (#113273)
Extensible plugins use a custom classloader for other plugin jars. When
extensible plugins were first added, the transport client still existed,
and elasticsearch plugins did not exist in the transport client (at
least not the ones that create classloaders). Yet the transport client
still created a PluginsService. An indirection was used to avoid
creating separate classloaders when the transport client had created the
PluginsService.

The transport client was removed in 8.0, but the indirection still
exists. This commit removes that indirection layer.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-09-27 03:55:44 +10:00
Iván Cea Fontenla
b8dcdd6303
Add CircuitBreaker to TDigest, Step 2: Add CB to array wrappers (#113105) (#113608)
Part of https://github.com/elastic/elasticsearch/issues/99815

## Steps
1. Migrate TDigest classes to use a custom Array implementation. Temporarily use a simple array wrapper (https://github.com/elastic/elasticsearch/pull/112810)
2. Implement CircuitBreaking in the `MemoryTrackingTDigestArrays` class. Add `Releasable` and ensure it's always closed within TDigest (This PR)
3. Pass the CircuitBreaker as a parameter to TDigestState from wherever it's being used
4. Account remaining TDigest classes size ("SHALLOW_SIZE")

Every step should be safely mergeable to main:
- The first and second steps should have no impact.
- The third and fourth ones will start increasing the CB count partially.

## Remarks
To simplify testing the CircuitBreaker, added a helper method + `@After` to ESTestCase.

Right now CBs are usually tested through MockBigArrays. E.g:
f7a0196b45/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractFunctionTestCase.java (L1263-L1265)
So I guess there was no need for this yet. But I may have missed something somewhere.

Also, I'm separating this PR from the "step 3" as integrating this (CB) in the current usages may require some refactor of external code, which may be somewhat more _dangerous_
2024-09-27 01:44:43 +10:00
Ignacio Vera
f7190599c2
Small performance improvement in h3 library (#113385) (#113429)
Changing some FDIV's into FMUL's leads to performance improvements
2024-09-24 16:08:52 +10:00
Iván Cea Fontenla
0e12d4a821
[8.x backport] Add CircuitBreaker to TDigest, Step 1: Arrays to BigArrays (#112810) (#113012)
# Backport of https://github.com/elastic/elasticsearch/pull/112810

Part of https://github.com/elastic/elasticsearch/issues/99815
2024-09-17 18:16:10 +02:00
Mark Vieira
0279c0a909
Add AGPLv3 as a supported license 2024-09-13 14:30:33 -07:00
Benjamin Trent
281ee04f7a
JSON parse failures should be 4xx codes (#112703)
It seemed if there wasn't any text to parse, this is not an internal
issue but instead an argument issue.

I simply changed the exception thrown. If we don't agree with this, I
can adjust `query` parsing directly, but this seemed like the better
choice.

closes: https://github.com/elastic/elasticsearch/issues/112296
2024-09-12 00:15:56 +10:00
Christoph Büscher
000ebaf7c2
Json parsing exceptions should not cause 500 errors (#111548)
Currently we wrap JsonEOFException from advancing the json parser into our own
XContentEOFException, but this has the drawback that is results in 500 errors on
the client side. Instead this should be 400 errors.
This changes XContentEOFException to extend XContentParseException so we report
a 400 error instead.

Closes #111542
2024-09-06 09:13:30 +02:00
Armin Braun
306491aa9d
Fix a few toString implementations+usages that affect test performance (#112380)
No need to precompute the toString for `ActionListener` and
`Releasable`, that's quite expensive at times. Also string concat is way
faster than formating these days, so use that in the transport channels.
Lastly, short-circuit some obvious spots in network address
serialization and remove code that duplicates the JDK (remove the IPV4
specific forbidden API because it makes no sense, but still needed to
disable the check to make the build green because of the exclude on the
parent class).
2024-08-30 15:17:18 +02:00
Chris Hegarty
569184871b
Add UpdateForV10 annotation (#112281)
In preparation for the next major release of Elasticsearch, this commit adds the UpdateForV10 annotation.
2024-08-29 08:23:34 +01:00
Nhat Nguyen
98fe686da4
Upgrade xcontent to Jackson 2.17.2 (#112320)
Avoid FasterXML/jackson-core#1256
2024-08-28 15:59:12 -07:00
Patrick Doyle
ae41e9ab65
Pluggable BuiltInExecutorBuilders (#111939)
* Refactor: move static calculations to Util

* BuiltInExecutorBuilders

* Spotless

* Change to getBuilders

* Move helper functions back into ThreadPool
2024-08-27 11:22:54 -04:00
David Turner
bff45aaa8a
Reduce CompletableFuture usage in tests (#111848)
Fixes some spots in tests where we use `CompletableFuture` instead of
one of the preferred alternatives.
2024-08-27 08:06:20 +01:00
Ryan Ernst
ef95cdd4cc
Fix native library loading zstd with jna (#112221)
Recent refactoring of native library paths broke jna loading zstd. This
commit fixes jna to set the jna.library.path during init so that jna
calls to load libraries still work.
2024-08-26 18:51:12 -07:00
Keith Massey
a02dc7165c
Improve performance of grok pattern cycle detection (#111947) 2024-08-26 13:39:19 -05:00
Kostas Krikellas
44758b3823
Restore useAlternatingSort in MergingDigest (#112148) 2024-08-26 10:00:39 +03:00
Ryan Ernst
0aa4758f02
Stop setting java.library.path (#112119)
Native libraries in Java are loaded by calling System.loadLibrary. This
method inspects paths in the java.library.path to find the requested
library. Elasticsearch previously used this to find libsystemd, but now
the only remaining use is to set the additional platform directory in
which Elasticsearch keeps its own native libraries.

One issue with setting java.library.path is that its not set for the cli
process, which makes loading the native library infrastructure from clis
difficult. This commit reworks how Elasticsearch native libraries are
found in order to avoid needing to set java.library.path. There are two
cases. The simplest is production, where the working directory is the
Elasticsearch installation directory, so the platform specific directory
can be constructed. The second case is for tests where we don't have an
installtion. We already pass in java.library.path there, so this change
renames the system property to be a test specific property that the new
loading infrastructure looks for.
2024-08-23 11:16:18 -07:00
Ryan Ernst
0f176e1779
Remove leftover libsystemd references (#112078)
Systemd notification now happens by directly communicating with the
systemd socket. This commit removes the native access to libsystemd,
which is no longer used.
2024-08-22 07:57:15 -07:00
Ryan Ernst
ba87a48833
Handle BigInteger in xcontent copy (#111937)
When xcontent is copied, the parse tree is walked and each element is
passed to the given generator. In the case of numbers, BigInteger is
currently not handled. Although arbitrary precision BigIntegers are not
supported in Elasticsearch, they appear in xcontent when using unsigned
long fields. This commit adds handling for that case, and also ensures
all token types are handled. Note that BigDecimal are not supported at
all since double is the largest floating point mapper supported.

closes #111812
2024-08-22 00:12:02 +10:00
Ryan Ernst
5a10545d37
Upgrade xcontent to Jackson 2.17.0 (#111948) 2024-08-20 06:07:08 -07:00
Ryan Ernst
69293e28dc
Use systemd socket directly instead of libsystemd (#111131)
The libsystemd library function sd_notify is just a thin wrapper
around opeing and writing to a unix filesystem socket. This commit
replaces using libsystemd with opening the socket provided by systemd
directly.

relates #86475
2024-08-19 16:31:59 -07:00
Ryan Ernst
0cf9c54f65
Fix windows memory locking (#111866)
Memory locking on Windows with the bundled jdk was broken by native
access refactoring. This commit fixes the linking issue, as well as adds
a packaging test to ensure memory locking is invoked on all supported
platforms.
2024-08-15 12:00:41 -07:00
Patrick Doyle
4516400143
More XContent long coercion cases (#111641)
* More XContent long coercion cases

* spotless
2024-08-14 08:08:58 -04:00
Craig Taverner
097fc0654f
Add maximum nested depth check to WKT parser (#111843)
* Add maximum nested depth check to WKT parser

This prevents StackOverflowErrors, replacing them with ParseException errors, which is more easily managed by running servers.

* Update docs/changelog/111843.yaml
2024-08-13 20:07:52 +02:00
Mikhail Berezovskiy
1163d2e4f9
Rename streamContent/Separator to bulkContent/Separator (#111716)
Rename `xContent.streamSeparator()` and
`RestHandler.supportsStreamContent()` to `xContent.bulkSeparator()` and
`RestHandler.supportsBulkContent()`.

I want to reserve use of "supportsStreamContent" for current work in
HTTP layer to [support incremental content
handling](https://github.com/elastic/elasticsearch/pull/111438) besides
fully aggregated byte buffers. `supportsStreamContent` would indicate
that handler can parse chunks of http content as they arrive.
2024-08-09 06:32:20 +10:00
Kostas Krikellas
0688cc27e8
Force using the last centroid during merging (#111644)
* Force using the last centroid during merging

* Update docs/changelog/111644.yaml

* spotless

* add asserts in test
2024-08-08 18:27:30 +03:00
Lorenzo Dematté
6fc0047f23
do not execute preallocate tests on encrypted storage (#111627) 2024-08-07 17:50:12 +02:00
Lorenzo Dematté
367133e605
Fix: tryPreallocate open ignored creation flag (#111294) 2024-08-05 18:48:50 +02:00
Albert Zaharovits
f352418ba7
Enforce JKS trustore for Azure IT (#111569)
Closes #111279 Closes #111345 Closes #111280 Closes #111307 Closes
#111377
2024-08-05 19:34:09 +10:00
Simon Cooper
17f819269a
Check the scale before converting xcontent long values, rather than the absolute value (#111538)
Large numbers are rejected, small numbers rounded to zero (if rounding enabled)
2024-08-05 10:31:09 +01:00
Luigi Dell'Aquila
8f3244d537
Fix Dissect with leading non-ascii characters (#111184) 2024-07-23 15:44:30 +02:00
Ryan Ernst
fcc5b737ea
Use ESTestCase for vector sysprop tests (#110990)
The VectorSystemPropertyTests need to run a child process. Normally this
isn't possible since we run with security manager, but the
`@WithoutSecurityManager` annotation causes the test suite to run with
the security manager disabled. However, that annotation only works with
ESTestCase. This commit changes the base class of the test suite to
ESTestCase.

closes #110949
2024-07-19 07:42:57 -07:00
Ryan Ernst
d21d4242dd
Skip preallocate tests on windows (#110998)
The preallocate tests assumed that preallocation was using the fallback
implementation which calls setLength on Windows. However, that fallback
only happens inside the SharedBytes class, so windows doesn't actually
do anything when tryPreallocate is called. This commit skips the test on
windows.

closes #110948
2024-07-19 05:59:35 -07:00
Ryan Ernst
08e91b7fbc
Add test for native preallocation (#110903)
This commit forward ports a test for native preallocation from #110851.
It also fixes fcntl and ftruncate bindings used by MacOS for
preallocation.
2024-07-16 09:06:01 -07:00
Ryan Ernst
e6713a5c0a
Remove JNA from server dependencies (#110809)
All native methods are now bound through NativeAccess. This commit
removes the jna dependency from server.

relates #104876
2024-07-12 19:49:13 -07:00
Ryan Ernst
e4349f8787
Force resolution of fstat64 symbol with JNA (#110807)
When JNA loads libraries it creates a proxy object for the library.
Unfortunately it doesn't actually inspect any of the methods, those get
bound lazily at runtime when the method is called through the proxy. For
fstat64 we need to know at load time whether the symbol exists, so that
we can fallback to an alternate function if it doesn't.

This commit looks up the NativeLibrary object from JNA for libc and
checks if fstat64 exists during load time.
2024-07-12 14:53:01 -07:00