Commit graph

157 commits

Author SHA1 Message Date
Yang Wang
6bc1452b43
Make repositories project aware (#128285)
Pass project-id explicitly to repository factory and make it part of the
repository interface.

Relates: ES-11839
2025-05-28 17:29:39 +10:00
Ryan Ernst
8ad272352b
Remove doPrivileged from ES modules (#127848)
Continuing the cleanup of SecurityManager related code, this commit
removes uses of doPrivileged in all Elasticsearch modules.
2025-05-09 14:15:48 -04:00
Ryan Ernst
ab690ba23f
Check hidden frames in entitlements (#127877)
Entitlements do a stack walk to find the calling class. When method
refences are used in a lambda, the frame ends up hidden in the stack
walk. In the case of using a method reference with
AccessController.doPrivileged, the call looks like it is the jdk itself,
so the call is trivially allowed. This commit adds hidden frames to the
stack walk so that the lambda frame created for the method reference is
included. Several internal packages are then necessary to filter out of
the stack.
2025-05-08 16:59:03 -07:00
Ryan Ernst
22a52a9c64
Remove security manager policy files (#127727)
Now that security manager is gone, the policy files are no longer
needed. This commit removes the server, test and plugin specific policy
files
2025-05-06 19:37:46 +02:00
David Turner
aa40147142
Add integ tests for ftp:// URL repository (#126757)
We document support for snapshot repositories using `ftp://` URLs but it
seems this functionality has not worked for many years because of
security-manager restrictions, although nobody noticed because it was
not covered by any tests. The migration to the Entitlements framework
means that this functionality now works again, so this commit adds tests
to make sure we do not break it again in future.
2025-04-15 12:57:00 +01:00
Dianna Hohensee
4b2867a0ef
Support maxConnections override in AbstractBlobContainerRetriesTestCase tests (#126435) 2025-04-08 09:55:01 -04:00
David Turner
fbbbdd7eec
Allow overriding blob container path in tests (#126391)
Some `AbstractBlobContainerRetriesTestCase#createBlobContainer`
implementations choose a path for the container randomly, but we have a
need for a test which re-creates the same container against a different
`S3Service` and `BlobStore` and must therefore specify the same path
each time. This commit exposes a parameter that lets callers specify a
container path.
2025-04-08 03:54:37 +10:00
Pooya Salehi
113f0c17cc
Limit number of suppressed S3 deletion errors (#123630)
We've seen this being an issue on 7.x although can happen on all 
versions (I'm pretty sure this PR doesn't cleanly back-port to 7.x
though).

Closes https://github.com/elastic/elasticsearch/issues/123354
2025-03-04 03:06:27 +11:00
Ryan Ernst
0cf42f2388
Rename environment dir accessors (#121803)
The node environment has many paths. The accessors for these currently
use a "file" suffix, but they are always directories. This commit
renames the accessors to make it clear these paths are directories.
2025-02-05 14:03:28 -08:00
Lorenzo Dematté
cd86b3b497
[Entitlements] Refactor Network Entitlement (#120391) 2025-01-20 18:29:32 +01:00
Patrick Doyle
34059c9dbd
Limit ByteSizeUnit to 2 decimals (#120142)
* Exhaustive testParseFractionalNumber

* Refactor: encapsulate ByteSizeUnit constructor

* Refactor: store size in bytes

* Support up to 2 decimals in parsed ByteSizeValue

* Fix test for rounding up with no warnings

* ByteSizeUnit transport changes

* Update docs/changelog/120142.yaml

* Changelog details and impact

* Fix change log breaking.area

* Address PR comments
2025-01-16 19:30:23 +00:00
Lorenzo Dematté
1848d6bb93
[Entitlements] Network access checks on Sockets (#120093) 2025-01-15 22:01:56 +01:00
Rene Groeschke
ba61f8c7f7
Update Gradle wrapper to 8.12 (#118683)
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
2024-12-30 15:34:24 +01:00
David Turner
0586cbfb34
Remove unused BlobStore#deleteBlobsIgnoringIfNotExists (#118245)
This method is never called against a general `BlobStore`, we only use
it in certain implementations for which a bulk delete at the `BlobStore`
level makes sense. This commit removes the unused interface method.
2024-12-09 15:46:22 +00:00
Iraklis Psaroudakis
32937109ac
Support writeAtomicBlob from InputStream for repository blob container interface (#112754)
Mostly for fs and hdfs repos, similar to how writeAtomicBlob from
bytes is implemented (write temp file and rename atomically).

Relates ES-9248
2024-09-17 16:08:51 +03:00
Mark Vieira
a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00
Mark Vieira
4ce661cc48
Bump Elasticsearch version to 9.0.0 (#112570) 2024-09-11 09:40:11 -07:00
Mark Vieira
24f33e95e8
Ensure rest compatibility tests are run when appropriate (#112526) 2024-09-05 08:22:48 -07:00
David Turner
5662f988b2
Remove trappy timeouts in snapshot APIs (#109828)
Wholesale fix of every `TRAPPY_IMPLICIT_DEFAULT_MASTER_NODE_TIMEOUT` in
`o.e.snapshots` and `o.e.repositories`, just pulling them up to the REST
layer (where they become API params), the test suite (where they become
`TEST_REQUEST_TIMEOUT`), or some other place where an explicit value is
available.

Relates #107984
2024-06-21 07:11:12 +10:00
Mikhail Berezovskiy
d6d782a767
Remove unused thread pool name assertions in tests (#107340)
Original method assertSnapshotOrStatelessPermittedThreadPool covers
testing thread pools names, no need for override.

Follow up for #106208
[comment](https://github.com/elastic/elasticsearch/pull/106208#pullrequestreview-1986768492)
2024-04-11 13:53:41 -04:00
Dianna Hohensee
73e8984164
Add documentation to thread pool and executor code (#106208) 2024-04-09 08:27:47 -04:00
David Turner
8133209355
URLRepository should not block shutdown (#105588)
Today a node with a registered `URLRepository` will not shut down
cleanly because it never releases the last of the `activityRefs`. This
commit fixes that.
2024-02-19 05:26:00 -05:00
Armin Braun
81280521a9
Make URLHttpClient load it's http client dependency lazily (#104590)
No need to load the http client classes eagerly here when most deployments don't use
the URL repository in the first place. Moves the overhead for having the URL repository code around but unused from
579kb to 32kb on my workstation (x86).
2024-01-22 13:50:28 +01:00
Rene Groeschke
f5be180cb2
Configure test fixture dir correctly (#102839)
Make just the basic configuration of a project using test fixture plugin
not break configuration cache.  This is just for not breaking caching of
the gradle configuration. Running tests task relying on  test fixture
plugin and its wiring is still configuration cache in complete. This is
just for unblocking other configuration cache related work. 

In the long run we are going to remove this plugin
2023-12-12 14:10:14 -05:00
Armin Braun
7a63a666e2
Dry up test code that extracts TotalHits from SearchResponse (#103269)
We have the pattern of getting a response only for its `TotalHits` in a couple of spots,
some of them still leaking the `SearchResponse`.
This PR dries up those that I could quickly identify to use the new utilty method to simplify this pattern
or just moves the code to `assertHitCount` where possible.
2023-12-11 18:25:22 +01:00
Yang Wang
b9c29807ec
Extract repositories metrics into its own class (#103034)
This PR is a follow up of
https://github.com/elastic/elasticsearch/pull/102505#discussion_r1402957598
that move the repositories metrics management into its own class which
is then passed around instead of relying on the raw meterRegistry and
string metric names.
2023-12-07 18:26:17 -05:00
Rene Groeschke
bc17acdada
Port repository-url to new TestFramework (#102588)
removes docker-compose dependency from url-fixture
2023-12-01 11:23:53 +01:00
David Turner
824d06c8cf
Use random purpose in blob store repository tests (#102789)
Today many blob store repository tests specify that the operations they
perform have purpose `OperationPurpose#SNAPSHOT`, but most of these
tests do not care about the purpose of these operations. This commit
switches them to using a random purpose to highlight that the purpose is
unimportant to the test.
2023-11-29 20:21:07 -08:00
Armin Braun
a9c286b25c
Collapse verbose .execute().actionGet() calls in tests (#102502)
Cleaning this up a little even though it's still quite horrible.
`.get()` in this API actually means `actionGet()` so to speak.
I think a good first step to cleaning this up is to at least reduce
the duplication though and save 1k lines.
2023-11-23 10:10:10 +01:00
Armin Braun
995b4d3c69
Cleanup redundant logger fields (#101655)
Making loggers static that can be made static, removing redundant test
loggers (we already have the correct per class logger in this.logger)
and also removing some just unused loggers.
2023-11-02 18:01:14 +01:00
Simon Cooper
22381fd6a7
Refactor overrides of old Plugin.createComponents method to new services method (#101381) 2023-10-26 16:58:14 +01:00
David Turner
b5843e4b98
Encapsulate snapshots deletion process (#100617)
Introduces the `SnapshotsDeletion` class which encapsulates the process
of deleting some collection of snapshots. In particular this class gives
us somewhere to store various deletion-wide data which significantly
reduces the length of some argument lists.

Relates #100568
2023-10-11 02:03:31 -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
Yang Wang
5628392fa5
Differentiate stats for the same blobstore operation with purposes (#99615)
Today blobstore stats are collected against each HTTP operation, e.g.
Get, List. This is not granular enough because the same HTTP operration
can be performed for different purposes, e.g. cluster state, indices or
translog. This PR adds a new Purpose enum to provide further breakdown
for the same HTTP operation. 

Relates: ES-6800
2023-10-02 06:37:08 -04:00
Przemyslaw Gomulka
eca41871aa
Use TelemetryProvider in Plugin::createComponents (#99737)
in order to avoid adding yet anther parameter to createComponents
a Tracer interface is replaced with TelemetryProvider.
this allows to get both Tracer and Metric (in the future) interfaces
2023-09-22 14:48:11 +02:00
Przemyslaw Gomulka
b6747b48ba
Rename tracing to telemetry package (#99710)
This commit renames the tracing to telemetry.tracing in both xpack/APM and elasticserach's org.elasticsearch.tracing.Tracer (the api)
the xpack/APM is renamed as follows:
org.elasticsearch.telemetry.apm - the only exported package
org.elasticsearch.telemetry.apm.settings - APMSettings
org.elasticsearch.telemetry.apm.tracing - APMTracer

org.elasticsearch.tracing.Tracer is moved to org.elasticsearch.telemetry.tracing.Tracer (responsible for majority of the changes in this PR)
2023-09-20 16:58:02 +02:00
Francisco Fernández Castaño
f6a2b5c9ef
Add bulk delete method to BlobStore interface and implementations (#98948) 2023-08-29 12:25:03 +02:00
Ievgen Degtiarenko
d9b6c5ae29
Wire IndicesService to plugins (#97081)
This change exposes IndicesService to the plugins via Plugin#createComponents
2023-06-27 18:02:23 +02:00
Armin Braun
1a34568a8b
Remove remaining redundant overrides (#97134)
Follow-up to #97130, removing all remaining redundant overrides outside
the server package.
2023-06-27 13:08:13 +02:00
Tim Brooks
ac829edc55
Enable skip methods on retrying inputstreams (#96337)
Currently we have a number of input streams that specifically override
the skip() method disabling the ability to skip bytes. In each case the
skip implementation works as we have properly implemented the
read(byte[]) methods used to discard bytes. However, we appear to have
disabled it as it would be possible to retry from the end of a skip if
there is a failure in the middle. At this time, that optimization is not
really necessary, however, we sporadically used skip so it would be nice
for the IS to support the method. This commit enables the super.skip()
and adds a comment about future optimizations.
2023-05-25 10:11:27 -06:00
David Turner
350beea181
Arbitrary bytes in blob store register (#96019)
Today the blob store register supports recording only a `long`,
represented as an 8-byte blob. We need to store a little more data in
the register, so this commit generalises things to work with a
`BytesReference` directly.
2023-05-16 06:16:21 -04:00
Armin Braun
af5c11702b
Use string list setting throughout codebase (#95901)
We can dry things up a little here and also making things a little faster
(in case we missed a corner case where a list setting is hot) with the optimized
string list setting constructor.
2023-05-09 11:22:28 +02: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
David Turner
95daf492fc
Async blob-store compare-and-exchange API (#94092)
Further work towards the S3 compare-and-exchange implementation showed
that we would like this API to permit async operations. This commit
moves to an async API.

Also, this change made it fairly awkward to use an exception to deliver
to the caller the indication that the current value could not be read,
so this commit adjusts things to use `OptionalLong` throughout as
suggested in the discussion on #93955.
2023-02-27 08:41:34 +00:00
Armin Braun
a6f63df111
Introduce BlobStoreRepository CAS Mechanism (#93825)
Only for testing purposes through the `FsRepository` for now and rather simple,
but should get the job done and technically be correct for a compliant NFS implementation.

Co-authored-by: David Turner <david.turner@elastic.co>
2023-02-16 14:26:12 +00:00
Chris Hegarty
e6a7a3452d
Modularize the repository-url component (#93717)
This change modularizes the repository-url component, by adding a module-info.java
2023-02-11 17:52:09 +00:00
Joe Gallo
582f1be95e
Update log4j2 LICENSE and NOTICE files (#93611) 2023-02-09 08:53:43 -05:00
Armin Braun
f2760c6e18
Nicer buffer handling (#93491)
Some optimisations that I found when reusing searchable snapshot code elsewhere:
* Add an efficient input stream -> byte buffer path that avoids allocations + copies for heap buffers, this is non-trivial in its effects IMO
  * Also at least avoid allocations and use existing thread-local buffer when doing input stream -> direct bb
  * move `readFully` to lower level streams class to enable this
* Use same thread local direct byte buffer for frozen and caching index input instead of constantly allocating new heap buffers and writing those to disk inefficiently
2023-02-06 10:55:56 +01:00
Ievgen Degtiarenko
ad229dd70e
Update createComponents to supply AllocationService instead of AllocationDeciders (#92785) 2023-01-10 14:18:33 +01:00
Artem Prigoda
2bc7398754
Use Strings.format instead of String.format(Locale.ROOT, ...) in tests (#92106)
Use local-independent `Strings.format` method instead of `String.format(Locale.ROOT, ...)`. 
Inline `ESTestCase.forbidden` calls with `Strings.format` for the consistency sake.
Add `Strings.format` alias in `common.Strings`
2023-01-03 19:28:27 +01:00