Commit graph

244 commits

Author SHA1 Message Date
Tim Brooks
c4698c625b Introduce watermarks for indexing pressure backoff (#113912)
Currently we have a relatively basic decider about when to throttling
indexing. This commit adds two levels of watermarks with configurable
bulk size deciders. Additionally, adds additional settings to control
primary, coordinating, and replica rejection limits.
2024-10-04 15:46:17 -05:00
David Turner
c32f81594f
More verbose logging in IndicesSegmentsRestCancellationIT (#113844) (#114003)
Relates #88201
2024-10-04 04:34:16 +10:00
David Turner
abb48bd131
Fix testClusterHealthRestCancellation (#113680) (#113756)
This test was failing due to a race between an early cancellation check
and the cancel operation. With this commit we wait until the action is
definitely blocked before cancelling the task.

Closes #100062
2024-09-30 17:57:04 +10:00
Tim Brooks
54ddc29fc7
Default incremental bulk functionality to false (#113416) (#113417)
This commit flips the incremental bulk setting to false. Additionally,
it removes some test code which intermittently causes issues with
security test cases.
2024-09-24 08:18:04 +10:00
Tim Brooks
b2eb101443
[8.x] Move raw path into HttpPreRequest (#113231) (#113309)
* Move raw path into HttpPreRequest (#113231)

Currently, the raw path is only available from the RestRequest. This
makes the logic to determine if a handler supports streaming more
challenging to evaluate. This commit moves the raw path into pre request
to allow easier streaming support logic.

* Fix
2024-09-21 07:42:31 +10:00
David Turner
422c26b659 Drop useless AckedRequest interface (#113255)
Almost every implementation of `AckedRequest` is an
`AcknowledgedRequest` too, and the distinction is rather confusing.
Moreover the other implementations of `AckedRequest` are a potential
source of `null` timeouts that we'd like to get rid of. This commit
simplifies the situation by dropping the unnecessary `AckedRequest`
interface entirely.
2024-09-20 13:04:49 +01:00
Tim Brooks
69c4a4f7e9
Backport incremental bulk execution (#113215)
This commit back ports all of the work introduced in:
https://github.com/elastic/elasticsearch/pull/113044

* #111438 - 5e1f655
* #111865 - 478baf1
* #112179 - 1b77421
* #112227 - cbcbc34
* #112267 - c00768a
* #112154 - a03fb12
* #112479 - 95b42a7
* #112608 - ce2d648
* #112629 - 0d55dc6
* #112767 - 2dbbd7d
* #112724 - 58e3a39
* dce8a0b
* #112974 - 92daeeb
* 529d349
* #113161 - e3424bd
2024-09-19 21:35:18 -06:00
Mark Vieira
0279c0a909
Add AGPLv3 as a supported license 2024-09-13 14:30:33 -07:00
Mikhail Berezovskiy
c1c5fe64b3
Use opaque id in task cancellation assertion (#110680)
Add use of Opaque ID HTTP header in task cancellation assertion. In some
tests, like this #88201 `testCatSegmentsRestCancellation`, we assert
that all tasks related to specific HTTP request are cancelled. But we do
blanket approach in assertion block catching all tasks by action name. I
think narrowing down assertion to specific http request in this case
would be more accurate.

It is still not clear why test mentioned above failing, but after hours
of investigation and injecting random delays, I'm inclining more to
@DaveCTurner's comment about interference from other tests or cluster
activity. I added additional log that will report when we spot task with
different opaque id.
2024-07-12 14:35:57 +10: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
Patrick Doyle
43b2e877e0
Revert "Move PluginsService to its own internal package (#109872)" (#109946)
This reverts commit b9e7965184.
2024-06-19 18:10:50 -04:00
Patrick Doyle
b9e7965184
Move PluginsService to its own internal package (#109872)
* Mechanical package change in IntelliJ
* A couple of manual fixups
* Export plugins.loading to deprecation
* Put plugin-cli in a module so can export PluginsUtils to it.
2024-06-19 15:23:47 -04:00
Ievgen Degtiarenko
d3a285e1c7
Fix testDanglingIndicesCanBeListed (#108599)
The test started failing because of the recent changes to allow closing (and deleting shards) asynchronously. As a result dandling index API now is seeing a directory in partially deleted state, fails to interpret partial data and fails as a result.
The fix retries the failure on the client.
2024-05-14 11:40:27 +02:00
David Turner
30d31bffb2
Introduce RestUtils#getMasterNodeTimeout (#107986)
Many APIs accept a `?master_timeout` parameter, but reading this
parameter requires a little unnecessary boilerplate to specify the
literal parameter name and default value. Moreover, today's convention
is to construct a `MasterNodeRequest` and then read the default master
timeout from the freshly-created request. In practice this results in a
default of 30s, but we specify in the docs that this default is _always_
30s, and in principle one could create a transport request with a
different initial value which would deviate from the documented
behaviour.

This commit introduces a utility method for reading this parameter in a
fashion which is completely consistent with the documented behaviour.

Relates #107984
2024-04-29 08:03:32 +01:00
Armin Braun
05a2ff0375
Remove some more ActionType implementations (#107664)
Cleaning up a couple more of these.
2024-04-20 20:01:04 +02:00
Jonathan Buttner
d8348560a9
muting (#107496)
Muting https://github.com/elastic/elasticsearch/issues/100062
2024-04-15 17:17:34 -04:00
Ievgen Degtiarenko
32bcb13ac4
Introduce an easy way to get node id by its name (#107392)
Our test utility returns the node name when starting a new node.
A lot of APIs (such as routing table or node shutdown) require a node id.
This change introduces a simple way to retrieve the node id based on its name.
2024-04-12 10:50:11 +02:00
David Turner
9a907704b7
Move XContent -> SnapshotInfo parsing out of prod (#106669)
The code to parse a `SnapshotInfo` object out of an `XContent` response
body is only used in tests, so this commit moves it out of the
production codebase and into the test framework.
2024-03-22 09:46:46 -04:00
David Turner
12e567d29e
Consolidate get-snapshots ?after logic (#106038)
Today the handling of the `?after` param is kinda spread out over
`TransportGetSnapshotsAction` and `GetSnapshotsRequest` making it hard
to follow and adding unnecessary complexity to these two classes. This
commit moves it into `SnapshotSortKey` which is a better fit since the
behaviour varies so much for different sort keys.
2024-03-12 05:16:46 -04:00
David Turner
1fae3e7501
Extract SnapshotSortKey (#106015)
The behaviour of the get-snapshots API varies quite considerably
depending on the sort key chosen. Today this logic is implemented using
scattered `switch` statements and other conditionals but it'd be clearer
if we delegated this stuff to the sort key instances themselves. This
commit moves the sort key enum to the top level and replaces one of the
`switch` statements with a method on the enum instances.
2024-03-06 15:27:57 +00:00
David Turner
7cbdb6cc19
Drop dead code from get-snapshots request & response (#105608)
Removes all the now-dead code related to reading pre-7.16 get-snapshots
requests and responses, and also moves the `XContent` response parsing
out of production and into the only test suite that uses it.
2024-02-21 07:57:50 +00:00
Ryan Ernst
b67f5a6b57
Make cluster feature predicate available to plugins (#105022)
A predicate to check whether the cluster supports a feature is available
to rest handlers defined in server. This commit adds that predicate to
plugins defining rest handlers as well.
2024-02-01 09:11:18 -08:00
Simon Cooper
016c778321
Remove NamedWriteableRegistry from NodeClient, pass it directly through to rest actions (#103277) 2024-01-11 12:42:22 +00:00
Lee Hinman
d297d79927
Fix require_alias implicit true value on presence (#104099)
* Fix `require_alias` implicit true value on presence

This commit brings the `require_alias` query-string parameter into line with the rest of our parameters where its presence indicates an implicit "true" value (so a user can do `POST /_bulk?require_alias` to enable the check).

Resolves #103945

* Update docs/changelog/104099.yaml
2024-01-09 10:08:41 -07:00
Mary Gouseti
046cdeae23
Introduce lazy rollover for mapping updates in data streams (#103309)
In this PR we implement the idea to introduce a flag, that a data stream needs to be rolloved over before the next document is indexed.
2024-01-08 15:07:16 +02:00
David Turner
60b833bb6d
Add utils for general XContent REST requests (#103711)
Tests that send REST requests with bodies must today build up a separate
`String` containing the body contents as JSON. This is kinda ugly, and
also means we do not cover the other supported body formats in these
tests. This commit introduces a utility to allow construction of REST
requests with `XContent` bodies directly, and generalizes things to
choose randomly between JSON and other supported body formats.
2024-01-02 13:39:21 +00:00
David Turner
2e592a3416
More logging for ClusterHealthRestCancellationIT (#103193)
Relates #100062
2023-12-08 08:48:52 -05:00
Armin Braun
e20821f13e
Remove some more ActionType subclasses (#103055)
Cleaned up a few more of these.
2023-12-07 22:05:45 +01:00
Armin Braun
c45b95d0eb
Remove some more ActionType subclasses (#102354)
Removing a couple more of these from the search package.

Co-authored-by: Joe Gallo <joegallo@gmail.com>
2023-11-27 19:11:19 +01:00
David Turner
8914314c1b
Record chunked response size before sending last chunk (#102586)
We expect that the HTTP response stats should reflect the responses
received by the client, but today we record that a chunked-encoded
response was sent _after_ sending the last chunk, which might mean that
the client can receive the complete response body and then retrieve
stats that do not include that response. With this commit we record the
stats before sending the last chunk.

Closes #102547
2023-11-27 05:36:20 -08:00
Yang Wang
e649a08a1b [Test mute] AwaitsFix #102547 2023-11-24 21:57:33 +11:00
Armin Braun
cdc83ad29b
Add shorthand for prepareIndex to test infrastructure (#101187)
Same as #101175, shorten `client().prepareIndex(index)` and
`client().prepareIndex().setIndex(index)` via a test utility.
Saves lots of code now and sets up some follow-up simplifcations.
2023-11-23 15:47:36 +01:00
David Turner
f017fab91f
Inline PlainActionFuture#newFuture (#102060)
There's no need for this static method which just calls the constructor,
the caller may as well construct the object directly.
2023-11-13 08:46:08 -05:00
David Turner
4099387441
Longer timeout & more logging in testClusterHealthRestCancellation (#101911)
Relates #100062
2023-11-08 15:13:36 +00:00
David Turner
4a37aef80b
Deprecate ExternalTestCluster (#101844)
`ExternalTestCluster` doesn't really make sense now that the transport
client is removed. We only use it in the ML integ test suite and it'd be
good to avoid expanding its usage further, so this commit deprecates it
and removes the functionality in `ESIntegTestCase` that might quietly
switch to using it in a new test suite if running with certain system
properties.

Relates #49582
2023-11-06 14:30:07 -05:00
David Turner
b158dc7ed0
Cancel via tasks API in RestActionCancellationIT (#101819)
We should get the same effect whether we cancel the task by closing the
REST connection or by using the tasks API. This commit generalises the
test to cover both cases.
2023-11-06 12:58:06 +00:00
David Turner
676e28e50b
Run TransportGetAliasesAction on local node (#101815)
This action is a pure function of the cluster state, it can run on any
node. Moreover it can be fairly expensive if there are a lot of aliases
so running it on the master can be quite harmful to the cluster.
Finally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.

Relates #101805
2023-11-06 05:46:04 -05:00
David Turner
6a50c1a04f
ActionFilter-based REST cancellation tests (#101811)
Today it is a little tricky to write tests for REST cancellation since
we must pause the action while it is running to ensure that the
cancellation has the desired effect. Many actions have some way to
achieve this, possibly requiring some amount of trickery, but some
actions have no natural point at which they can be paused.

This commit introduces an `ActionFilter`-based approach to capture the
task just after it has been registered but before it starts executing.
All REST actions pass through the `ActionFilter` chain at least once, so
this technique should work everywhere.

This commit also removes the hooks that were added to test the
cancellability of the recovery APIs since they're no longer needed.
2023-11-06 09:01:36 +00:00
Simon Cooper
43a3730df9
Refactor PluginsService.filterPlugins to return a Stream rather than a List (#101522) 2023-10-31 10:09:14 +00:00
Armin Braun
588fed797b
Remove redundant ActionType classes (#101037)
Got asked why we have these classes again last night ... figured I'd
remove some of them to get us going here.

None of these classes are necessary, we can just inline all of these
away and make `ActionType` itself final or a record now that the action
type consists only in name and reader. See #97721 that made these things
redundant I think.
2023-10-18 06:14:12 -04:00
Yang Wang
6ed4ad54bd
Record more detailed HTTP stats (#99852)
This PR adds more details HTTP stats breaking down by HTTP routes.

Resolves: #95739
2023-10-12 07:27:04 -04:00
Alan Woodward
f580501bc9
Remove StatusToXContent interface (#99824)
The StatusToXContent interface extends ToXContent with a REST status
method. It is used by RestStatusToXContentListener, which uses the extra
method to set the status of the RestResponse. However, given the
generics parametrization of RestToXContentListener, we can already get
the status of a response object without having these extra interfaces,
which mix serialization and status concerns.

This commit removes StatusToXContent and RestStatusToXContentListener,
instead adding some extra optional parameters to RestToXContentListener to
handle retrieving status and location information from the passed in Response
object.
2023-10-02 13:57:29 +01: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
Armin Braun
4d29cb20b8
Add shortcuts for getting snapshot customs from cluster state (#98906)
Drying up the logic for looking up the customs and falling back to the empty default. Hopefully, this improves readability somewhat by taking away that complexity and some null checks.
I like it at least, saves a lot of clutter.

Re-revert of #98896, only fixing a single null check in tests.
2023-08-26 07:27:57 +02:00
Mark Vieira
f756b046e5
Revert "Add shortcuts for getting snapshot customs from cluster state (#98331)" (#98896)
Reverts #98331.

cc @original-brownbear
2023-08-25 16:27:44 -04:00
Armin Braun
9a3f24fe2f
Add shortcuts for getting snapshot customs from cluster state (#98331)
Drying up this logic a little to hopefully improve readability somewhat.
2023-08-25 17:10:45 +02:00
William Brafford
874fbbc2f0
Add mappings version number to SystemIndexDescriptor (#97934)
This PR adds a mappings version number to system index descriptor, which is intended to replace the use of Version to signal changes in the mappings for the descriptor. This value is required for managed system indices.

Previously, most of the system index descriptors automatically incremented their mapping version with each release, which meant that the mappings would stay up-to-date with any additive changes. Now, developers will need to increment the mapping version whenever there's a change.

* Add MappingsVersion inner class to SystemIndexDescriptor
* Add mappings version to metadata in all system index mappings
* Rename version meta key ('system' -> 'managed')
* Update mappings for ML indices if required
* Trigger ML index mappings updates based on new index mappings version.

---------

Co-authored-by: Ed Savage <ed.savage@elastic.co>
2023-08-17 00:03:12 -04: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
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
David Turner
1a942317a4
Make cluster health API cancellable (#96551)
This API can be quite heavy in large clusters, and might spam the
`MANAGEMENT` threadpool queue with work for clients that have long-since
given up. This commit adds some basic cancellability checks to reduce
the problem.
2023-06-21 08:05:39 -04:00