Commit Graph

54 Commits

Author SHA1 Message Date
Stuart Tettemer d8b2c52c82
Metrics refactor - split registry and service (#101154)
This splits out the registry and the service, which makes testing easier and removes much of the delegation from the old `APMMeter` to `Instruments` (now renamed `APMMeterRegistry`).

APMMeterService takes care of the lifecycle and APMMeterRegistry holds the instruments.
2023-10-23 13:28:46 -05:00
Yang Wang 525fe59ee2
Make APM meter available in s3 blobstore (#100464)
This PR wires the new Meter interface into S3BlobStore. The new meter
field remains unused in this PR. Actual metric collection will be
addressed in follow-ups.

Relates: ES-6801
2023-10-09 06:01:20 -04: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
Tim Vernum d411acecbc
Suppress this-escape warning for JDK21 (#99848)
Adds @SuppressWarnings("this-escape") to all necessary places to that
Elasticsearch can compile with -Werror on JDK21

No investigation has been done to determine whether any of the cases
are a potential source of errors - we have simply suppressed all
existing occurrences.

Resolves: #99845
2023-09-25 18:30:21 +10: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
Volodymyr Krasnikov 6e7bc27622
Update Guava dependency version to 32.0.1-jre (#97033)
* Update Guava dependency version

* Update gradle verification metadata

* fix :repository-gcs:thirdPartyAudit

* fix :discovery-gce:thirdPartyAudit

* Use single sha256 hash in allowed list
2023-06-27 09:14:10 -07:00
Armin Braun dd7d381922
Dry up getting cluster admin client in tests (#96952)
Drying this up further and adding the same short-cut for single node
tests. Dealing with most of the spots that I could grab via automatic
refactorings.
2023-06-22 14:27:23 +02:00
Pooya Salehi 193e9201d7
Use dynamic port range in testLoadsProxySettings (#96378)
Closes https://github.com/elastic/elasticsearch/issues/95821
2023-05-26 09:27:06 -04: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
Mark Vieira 9502d39c96
Refactor GCS test fixture to remove docker dependency (#94755) 2023-05-17 11:05:26 -07: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
Artem Prigoda 44ab318a24
Migrate MockHttpServer to Apache HttpServer (#94205)
Instead of using raw TCP sockets and parsing HTTP requests manually which is tends to be quite error-prone, we can create an HTTP proxy server using ApacheHttpServer. In contrast to com.sun.net an Apache HTTP server it can act as an HTTP proxy.

This change also allows the server to support persistent keep-alive connections. It should prevent creating excessive threads to handle new HTTP connection which matters when we run heavy tests in GcsProxyIntegrationTests.

It's a more straighforward alternative to #93891.

Fixes #93824
Fixes #93811
Fixes #93816
2023-03-27 16:47:29 +02:00
Mark Vieira cbc73a7665
Register test artifacts for service-account security QA project (#94602) 2023-03-21 12:15:05 -07:00
David Turner 12cc9aadf3
GCS compare-and-exchange implementation (#94247) 2023-03-06 11:38:43 -05: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
Artem Prigoda 8cb2bb57ba
Mute GcsProxyIntegrationTests (#93812)
See #93811
2023-02-15 11:53:03 +01:00
Artem Prigoda b3ff847da1
Support for GCS proxies everywhere in the GCS API (#92192)
Currently, if the user set proxy setting for the GCS repository, they are only used for interactions with the GCS API, but not the other network interactions that the the module performs (refreshing OAuth tokens, fetching metadata) outside of the SDK.

Fix that by making sure that all network interactions go via proxy if it's configured.

Fixes #91952
2023-02-14 10:08:46 +01: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
Jake Landis 93ecc4d7b3
Consolidate google-oauth-client to latest version (#91722)
related: #87800
fixes #90126
2023-02-01 12:01:52 -06: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
Rene Groeschke f4c01cdb42
Fix thirdpartyAudit check for graalvm runtime (#92635)
fixes #92577
2023-01-03 16:10:03 +01:00
Pooya Salehi 8515535652
Upgrade GCS SDK to 2.13.1 (#92327)
Upgrade to the latest version of the SDK that doesn't have known CVEs
and builds w/o complaining. Since 2.2.0 the automatic retry behaviour
has changed and the old behaviour can still be used as
LegacyStorageRetryStrategy. The default retry strategy would cause some
test failures, and therefore we'd need to explicitly set a retry
strategy.

Relates #92474
2022-12-22 13:34:38 +01:00
Mark Vieira c2eda511de
Add JUnit rule based integration test cluster orchestration framework (#92379)
This commit adds a new test framework for configuring and orchestrating
test clusters for both Java and YAML REST testing. This will eventually
replace the existing "test-clusters" Gradle plugin and the build-time
cluster orchestration.
2022-12-21 15:33:46 -08:00
Iraklis Psaroudakis 60870d6046
Move GCS TestUtils to fixture (#92370) 2022-12-14 17:22:12 +02:00
Keith Massey b8780d3b24
Align all usages of protobuf to be 3.21.9 (#92123)
Updating repository-hdfs, repository-gcs, and vector-tile to all use the same more recent protobuf.
2022-12-07 11:55:18 -06:00
Ievgen Degtiarenko cd820b6f6d
Replace needless map builder with Map.of(..) (#91310) 2022-11-07 09:39:12 +01:00
Armin Braun 362a7f0a95
Make some ByteSizeValue instances always use the singleton (#91178)
This comes out of a user heap dump investigation. In some snapshot
corner cases we ran into about 100M of duplicate 0b instances.

-> even though it's a little heavy handed, lets make it so the common
constants that we already have are used whenever possible.
2022-10-28 16:53:49 +02:00
Rene Groeschke 43a0377735
Update forbiddenapis to 3.4 (#90624)
Fix breaking changes to source validation after change in default jdk rule set
2022-10-06 16:52:06 +02:00
Armin Braun 97c533a562
Increase snaphot pool max size to 10 (#90282)
As discussed, we can be up to twice as fast without increasing CPU use
much on high latency blob stores so increasing the pool size to 10 here
to better utilize larger data nodes.
2022-09-23 17:06:57 +02:00
David Turner 621c38cde5
Report better error for GCS credentials load failure (#89336)
Today if the GCS credentials file setting is invalid we report some kind
of JSON parsing error but it's not clear what JSON is being parsed so
the error is hard to track down. This commit adds the problematic
setting name to the exception message.
2022-08-15 19:12:50 +09:30
Rene Groeschke 3909b5eaf9
Add verification metadata for dependencies (#88814)
Removing the custom dependency checksum functionality in favor of Gradle build-in dependency verification support. 

- Use sha256 in favor of sha1 as sha1 is not considered safe these days.

Closes https://github.com/elastic/elasticsearch/issues/69736
2022-08-04 09:51:16 +02:00
Chris Hegarty 453f12c72d
Upgrade to Log4J 2.18.0 (#88237) 2022-07-04 11:30:38 +01:00
Armin Braun 0132541d60
Remove redundant BlobMetadata interface (#87705)
No need to have more than a simple record here at this point.
2022-06-18 20:41:32 +02:00
Armin Braun 2312bce463
Upgrade GCS Plugin to 1.118.1 (#87800)
Upgrade GCS Plugin to 1.118.1
2022-06-17 17:54:59 +02:00
Przemyslaw Gomulka 43b69b6f70
Replace new ParametrizedMessage() with java.util.Supplier<String> (#87077)
This is a result of structural search/replace in intellij. This only affects log methods with a signature
logger.info(ParametrizedMessage)
logger.info(ParametrizedMessage, Throwable)

relates https://github.com/elastic/elasticsearch/issues/86549
2022-05-26 11:21:35 +02:00
Przemyslaw Gomulka 86142aad84
Refactor log4j supplier of ParameterizedMessage with throwable (#87022)
This is a result of structural search/replace in intellij. This only affects log methods with a signature
logger.info(Supplier<?>, Throwable) where level could be info/debug etc and supplier argument is in a form of
()-> new ParameterizedMessage

relates #86549
2022-05-24 12:09:46 +02:00
Przemyslaw Gomulka 24fa003f5c
Replace supplier of ParameterizedMessage with java.util.Supplier<String> (#86971)
This is a result of structural search/replace in intellij. This only affects log methods with a signature
logger.info(Supplier<?>) where level could be info/debug etc and supplier argument is in a form of
()-> new ParameterizedMessage

This commit also introduced a Strings utility class to avoid passing Locale.ROOT to every
String.format(Locale.ROOT, pattern, args)
relates #86549
2022-05-23 08:51:07 +02:00
Ryan Ernst af7525e1f0
Upgrade jackson to 2.13.2 (#86051)
Most of the Jackson uses, eg in x-content and azure, have already been
upgraded. This commit upgrades the rest of the uses. Note that it does
not yet upgrade the aws sdk, this should also be done on its own.
2022-04-22 07:21:17 -07:00
Ryan Ernst b2c9028384
Move io utils to core package (#85954)
Most classes under elasticsearch-core had been moved to the o.e.core
package. However, a couple io related classes remained in an "internal"
package. This commit moves Streams and IOUtils to the core package, as
they are no more "internal" than the rest of the classes in core.
2022-04-19 21:26:28 -07:00
Artem Prigoda 026fb09329
Expose proxy settings for GCS repositories (#85785)
They were added in #82737, but not exposed via the GCSPlugin to end users.
2022-04-12 19:50:08 +02:00
Rene Groeschke 35448a2f29
Use explodedBundle for test cluster module configurations (#84997)
This removes the overhead of zipping modules that are referenced in
test cluster configurations
We now Support declaring task providers as module input in testclusters
2022-03-24 08:30:19 +01:00
Armin Braun 2a00f25f57
Move to .toList() Collection to fix Potential Bugs (#84864)
I noticed a few spots where we rely on the not-guaranteed
behavior of `Collectors.toList()` producing a mutable List.
I fixed those that Idea could quickly find and replaced
many other spots that were using the collector with `toList()`
which always creates a faster+immutable list (to make sure
we were not relying on mutable lists in more spots).

Relates to #84760
2022-03-14 13:20:48 +01: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
Ryan Ernst dae889b3e5
Forbid guava group instead of artifact name (#83546)
We disallow including guava on the compile classpaths, but currently
this only forbids the main guava artifact. Yet there are other artifacts
(eg failureaccess) provided by guava. This commit changes the dependency
check to use the guava group instead of artifact name.
2022-02-15 08:56:21 -08:00
Przemyslaw Gomulka 037261356e
Convert 'id' and '_id' values in REST API tests to strings (#82681)
Follow-up from #77144 (comment) with converting id/_id to always be strings instead of integers. This makes the type value in the Elasticsearch specification be only string instead of string | number.

this change was generated using following command on ubuntu
find . -type f -name "*.yml" -print0 | xargs -0 sed -i -r 's/([^a-zA-Z0-9_\.]id|[^a-zA-Z0-9_]_id):(\s*)([0-9]+)/\1:\2"\3"/g'
2022-02-10 09:14:17 +01:00
David Turner 33b3ccaabc
Rename InternalTestCluster#getMasterNodeInstance (#83407)
This method's name is trappy: it is easy to misinterpret it as returning
an instance from the elected master, but in fact it uses any
master-eligible node. If you want an instance from the elected master,
you have to use `getCurrentMasterNodeInstance()` instead.

This commit renames the method to clarify that it might not get an
instance from the elected master, and adds docs with cross-refs to help
developers choose the right method.
2022-02-08 08:26:14 -05:00
Artem Prigoda 0f97a85254
Remove assertion about GCS credentials always being null when not set explicetly (#83139)
After we fixed getting application credentials in a GCE environment in #82974, we can actually
get credentials set automatically when creating a new GCS client

Fixes #83131
2022-01-26 15:09:56 +01:00
Artem Prigoda d88d480100
Mute GoogleCloudStorageServiceTests.testClientInitializer (#83132) 2022-01-26 10:52:40 +01:00