Commit graph

76812 commits

Author SHA1 Message Date
Luigi Dell'Aquila
20846b8df1
ES|QL: Fix warnings for number overflow in CSV SPEC tests (#107745) (#107754)
Fixes https://github.com/elastic/elasticsearch/issues/107733

Number overflow can return warnings with `InvalidArgumentException` or
`QlIllegalArgumentException` depending on the version of the node where
it's executed
2024-04-23 05:58:05 -04:00
Alexander Spies
b9adf9ee35
[8.14] ESQL: median, count and count_distinct over constants (#107414) (#107749)
* Make COUNT(constant) consistent.
* Add MEDIAN(const) and COUNT_DISTINCT(const).
* Fix wrong stats pushdown when multiple COUNT aggs are in the same STATS
2024-04-23 11:14:20 +02:00
Kostas Krikellas
eaf0238fa6
Remove test rollup/security_tests/Attribute-based access (#107677) (#107742) 2024-04-23 03:27:42 -04:00
Brian Seeders
e3d8bce7be
[ci] Add Buildkite metrics/logs links to buildscans (#107719) (#107726)
(cherry picked from commit 1100689b50)
2024-04-22 17:37:55 -04:00
David Turner
f69b6afdb0
Fix line break in "The QUICK brown foxes jumped over the dog!" (#107718) (#107732)
Preformatted strings preserve line breaks, but no line break was
intended here.

Co-authored-by: 草原狼 <20969793+coyoteXujie@users.noreply.github.com>
2024-04-22 17:09:00 -04:00
Chris Hegarty
e4e0e326a6
ES|QL: Update the REST API specification "stability" property from experimental to stable (#107697) (#107715)
This commit updates the REST API specification "stability" property from experimental to stable, as the ES|QL endpoints move towards GA.
2024-04-22 12:24:29 -04:00
Jonathan Buttner
70de08ca22
[ML] Inference API fixing bug where request timeout can be null (#107648) (#107712)
* Adding test class

* Finishing a test

* Testing timeout from params

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-04-22 12:02:55 -04:00
Luigi Dell'Aquila
a4b27b9ff4
Mute TSDBRestEsqlIT (#107696) (#107702)
See https://github.com/elastic/elasticsearch/issues/107557
2024-04-22 09:44:59 -04:00
Bogdan Pintea
1bb6f180a9
ESQL: Allow reusing BUCKET grouping expressions in aggs (#107578) (#107693)
This fixes the queries reusing in STATS aggs part of expressions with
`BUCKET` declared in STATS grouping part.

Ex: `| STATS BUCKET(salary, 1000.) + 1 BY BUCKET(salary, 1000.)`

This was failing since the agg BUCKET's `salary` reference is no longer
available in the synthetic EVAL generated on top of the aggregation,
evaluating the "aggs" expression (the addition in the example above).
2024-04-22 09:21:27 -04:00
David Turner
24dcfe758f
Fix up hot threads timeout docs (#107692) (#107695)
The hot threads API does not support a `?master_timeout` parameter, and
the `?timeout` parameter is not an ack timeout and defaults to an
infinite wait. This commit fixes the incorrect docs.
2024-04-22 09:04:23 -04:00
Alexander Spies
5abceca215
ESQL: Fix mixed cluster tests (#107680) (#107690)
* Fix a test where pre-8.13 nodes in mixed cluster tests were sent a language version (added in 8.13.3).
* Skip a test for a fix introduced in 8.13.2 on older clusters.
2024-04-22 08:53:23 -04:00
Bogdan Pintea
cda1e4e620
SQL: Fix JdbcPreparedStatementIT.testDatetimeWithNanos (#107629) (#107685)
Fixes #105677
2024-04-22 08:16:14 -04:00
Craig Taverner
d888413525
Fails 3/10000 times, so we're slightly less restrictive with numerical errors (#107679) (#107684)
Fixes #106126
2024-04-22 07:42:43 -04:00
Ignacio Vera
789ad6ad86
Use #addWithoutBreaking when adding a negative number of bytes to the circuit breaker in SequenceMatcher (#107655) (#107672)
This change is to avoid calling the real memory circuit breaker when adding negative bytes.
2024-04-22 04:19:42 -04:00
Martijn van Groningen
cbfe5670e1
Address zstd release test failures in CodecTests. (#107477) (#107660)
The tests can only be run when zstd feature flag is enabled.

Closes #107417
2024-04-19 18:12:04 -04:00
Albert Zaharovits
dc6a344dd7
Abstract realm cache clear for role mappers (#107360) (#107654)
This is mostly a refactoring but also a minor bug-fix.
The bug-fix avoids potentially many unnecessary realm cache invalidations when
the state of the .security index changes.

Backport of #107360
2024-04-19 13:33:16 +03:00
Nik Everett
959e79a6cf
ESQL: Fix a test bug (#107642) (#107644)
The `RLIKE` test didn't think `#` was a special character. It is.

closes #107588
2024-04-18 16:05:33 -04:00
Brian Seeders
bb5a9296f4
[ci] Add checkPart4 to missing locations (#107552) (#107586)
(cherry picked from commit 91d3bb026f)
2024-04-18 14:38:12 -04:00
Mark Tozzi
4fb20a28ac
[ESQL] Add in the autogenerated docs for a bunch of functions (#107633) (#107641) 2024-04-18 14:32:50 -04:00
Mark Vieira
a8c606048a
Muted test automation (#106784) (#107636)
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
2024-04-18 14:32:34 -04:00
William Brafford
59eac097aa
Mute flaky blocked thread pool test (#107625) (#107630) (#107631) 2024-04-18 13:19:24 -04:00
Michael Peterson
680358c866
Users with monitor privileges can access async_search/status endpoint even when setting keep_alive (#107383) (#107615)
Fixes a bug in the async-search status endpoint where a user with monitor privileges
is not able to access the status endpoint when setting keep_alive state of the async-search.
2024-04-18 11:53:17 -04:00
Lee Hinman
589950e417
GA data stream lifecycles in documentation (#107582) (#107623)
This commit removes the warning about techincal preview for the data stream lifecycle documentation pages.
2024-04-18 11:31:00 -04:00
Bogdan Pintea
f6bd2c92d0
SQL: Limit how much space some string functions can use (#107333) (#107622)
This will check and fail if certain functions would generate a result
exceeding a certain fixed byte size.

This prevents an operation/query to fail the entire VM.
2024-04-18 11:16:51 -04:00
David Turner
b7f37c872a
Fix CONCURRENT_REPOSITORY_WRITERS link (#107603) (#107609)
This page was split up in #104614 but the `ReferenceDocs` symbol links
to the top-level page still rather than the correct subpage. This fixes
the link.
2024-04-18 08:29:03 -04:00
David Turner
52e8aea836
Add links to repo troubleshooting sub-pages (#107604) (#107611)
Since #104614 the top-level repo troubleshooting page is just a short
paragraph which talks about "this page" but in fact refers to
information spread across a number of subsequent pages. It's not obvious
to the reader that they need to use the navigation menu to get to the
information they seek. Moreover we link to this page from an exception
message today so there's a reasonable chance that users will find it
when trying to troubleshoot a genuine problem.

This commit rewords things slightly and adds links to the subsequent
pages to the body of the page to avoid this confusion.
2024-04-18 07:49:15 -04:00
Luca Cavanna
77a23e5d9f
Avoid attempting to load the same empty field twice in fetch phase (#107551)
During the fetch phase, there's a number of stored fields that are requested explicitly or loaded by default. That information is included in `StoredFieldsSpec` that each fetch sub phase exposes.

We attempt to provide stored fields that are already loaded to the fields lookup that scripts as well as value fetchers use to load field values (via `SearchLookup`). This is done in `PreloadedFieldLookupProvider.` The current logic makes available values for fields that have been found, so that scripts or value fetchers that request them don't load them again ad-hoc. What happens though for stored fields that don't have a value for a specific doc, is that they are treated like any other field that was not requested, and loaded again, although they will not be found, which causes overhead.

This change makes available to `PreloadedFieldLookupProvider` the list of required stored fields, so that it can better distinguish between fields that we already attempted to load (although we may not have found a value for them) and those that need to be loaded ad-hoc (for instance because a script is requesting them for the first time).

This is an existing issue, that has become evident as we moved fetching of metadata fields to `FetchFieldsPhase`, that relies on value fetchers, and hence on `SearchLookup`. We end up attempting to load default metadata fields (`_ignored` and `_routing`) twice when they are not present in a document, which makes us call `LeafReader#storedFields` additional times for the same document providing a `SingleFieldVisitor` that will never find a value.

Another existing issue that this PR fixes is for the `FetchFieldsPhase` to extend the `StoredFieldsSpec` that it exposes to include the metadata fields that the phase is now responsible for loading. That results in `_ignored` being included in the output of the debug stored fields section when profiling is enabled. The fact that it was previously missing is an existing bug (it was missing in `StoredFieldLoader#fieldsToLoad`).

Yet another existing issues that this PR fixes is that `_id` has been until now always loaded on demand when requested via fetch fields or script. That is because it is not part of the preloaded stored fields that the fetch phase passes over to the `PreloadedFieldLookupProvider`. That causes overhead as the field has already been loaded, and should not be loaded once again when explicitly requested.
2024-04-18 09:26:32 +02:00
Mary Gouseti
b13aa013de
[DSL] Remove REST APIs for global retention (#107565) (#107596)
(cherry picked from commit 732c7c4c30)
2024-04-18 02:55:47 -04:00
Oleksandr Kolomiiets
f28529d237
Handle infinity during synthetic source construction for scaled float field (#107494)
For really large values, rounding error is enough to push the
reconstructed value for synthetic source into infinity. Existing code
didn't take it into account. This PR adds a check to detect infinity and
just proceed with returning it as is in synthetic source.

Closes #107101.
2024-04-17 12:33:21 -04:00
Keith Massey
5f5947799b
Adding a putIfAbsent() method on EnrichCache (#107499) 2024-04-17 11:08:51 -05:00
Simon Cooper
eb6af0e6b5
Refactor PathTrie to tidy it up (#107542) 2024-04-17 15:29:22 +01:00
David Turner
3df8afbafc AwaitsFix for #107568 2024-04-17 15:07:07 +01:00
Alexander Spies
adaa4763f3
ESQL: Fix missing refs due to pruning renamed grouping columns (#107328)
Sometimes, CombineProjections does not correctly update an aggregation's groupings when combining with a preceding projection.
Fix this by resolving any aliases used in the groupings and de-duplicating them.

---------

Co-authored-by: Andrei Stefan <astefan@users.noreply.github.com>
2024-04-17 16:04:51 +02:00
Przemysław Witek
dbb700c679
Fix and unmute "Test frequent item sets unsupported types" yml test (#107350) 2024-04-17 14:39:50 +02:00
Liam Thompson
33a71e3289
[DOCS] Refactor book-scoped variables in docs/reference/index.asciidoc (#107413)
* Remove `es-test-dir` book-scoped variable

* Remove `plugins-examples-dir` book-scoped variable

* Remove `:dependencies-dir:` and `:xes-repo-dir:` book-scoped variables

- In `index.asciidoc`, two variables (`:dependencies-dir:` and `:xes-repo-dir:`) were removed.
- In `sql/index.asciidoc`, the `:sql-tests:` path was updated to fuller path
- In `esql/index.asciidoc`, the `:esql-tests:` path was updated idem

* Replace `es-repo-dir` with `es-ref-dir`

* Move `:include-xpack: true` to few files that use it, remove from index.asciidoc
2024-04-17 14:37:07 +02:00
Martijn van Groningen
9b91d9c072
Adjust exception checking for geoip downloader error logging. (#107550)
Sometimes an exception is wrapped multiple times and then these logs are being emitted:

```
org.elasticsearch.transport.RemoteTransportException: [es-es-index-64c4d7dcd-4d7qb][10.2.58.152:9300][cluster:admin/persistent/start]
Caused by: org.elasticsearch.transport.RemoteTransportException: [es-es-index-64c4d7dcd-j7s7v][10.2.9.216:9300][cluster:admin/persistent/start]
Caused by: org.elasticsearch.ResourceAlreadyExistsException: task with id {geoip-downloader} already exist
	at org.elasticsearch.persistent.PersistentTasksClusterService$1.execute(PersistentTasksClusterService.java:120)
	at org.elasticsearch.cluster.service.MasterService$UnbatchedExecutor.execute(MasterService.java:550)
	at org.elasticsearch.cluster.service.MasterService.innerExecuteTasks(MasterService.java:1039)
	at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:1004)
	at org.elasticsearch.cluster.service.MasterService.executeAndPublishBatch(MasterService.java:232)
	at org.elasticsearch.cluster.service.MasterService$BatchingTaskQueue$Processor.lambda$run$2(MasterService.java:1645)
	at org.elasticsearch.action.ActionListener.run(ActionListener.java:356)
	at org.elasticsearch.cluster.service.MasterService$BatchingTaskQueue$Processor.run(MasterService.java:1642)
	at org.elasticsearch.cluster.service.MasterService$5.lambda$doRun$0(MasterService.java:1237)
	at org.elasticsearch.action.ActionListener.run(ActionListener.java:356)
	at org.elasticsearch.cluster.service.MasterService$5.doRun(MasterService.java:1216)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:984)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.lang.Thread.run(Thread.java:1583)
```

In this case the real cause is `ResourceAlreadyExistsException`, which should't be logged as an error. Adjusted the exception cause checking to take into account that an exeception maybe wrapped twice by a `RemoteTransportException`.
2024-04-17 14:15:48 +02:00
David Turner
2f9e753463
Add setting for max connections to S3 (#107533)
The S3 SDK permits changing the maximum number of concurrent connections
that it will open, but today there's no way to adjust this setting
within Elasticsearch. This commit adds a setting for this parameter.
2024-04-17 06:49:02 -04:00
David Turner
a94f2b056a
Always validate node ID on relocation (#107420)
Follow-up to complete the change started in #107407, removing the
temporary compatibility shim.
2024-04-17 05:41:26 -04:00
Kostas Krikellas
6c4e01e331
Revert "Muting (#107484)" (#107500)
This reverts commit ae23a6f85a.
2024-04-17 12:09:41 +03:00
Armin Braun
1d0c470de0
Stop using ReleasableLock in o.e.c.cache.Cache to save O(10M) in heap (#107555)
I have a couple heap dumps that show the lock wrapper alone waste O(10M)
in heap for these things. Also, I suspect the indirection does cost
non-trivial performance here in some cases. => lets spend a couple more
lines of code to save that overhead
2024-04-17 04:55:32 -04:00
Liam Thompson
84f1b26953
Update esql-version.asciidoc (#107547)
Fix heading misalignment and typo.
2024-04-17 09:54:56 +02:00
Keith Massey
f5c7938ab8
Adding cache_stats to geoip stats API (#107334) 2024-04-16 16:57:14 -05:00
Oleksandr Kolomiiets
f1f271f633
[TEST] Unmute TextFieldMapperTests#testBlockLoaderParentFromRowStrideReader (#107548)
Randomly stumbled upon this - #104158 which is referenced is closed so this can be unmuted.
2024-04-16 14:56:15 -07:00
William Brafford
5a2dc6dc00
Fix system index thread pool tests (#107443)
* Allow rejected executions when filling up a thread pool queue
* Move test to integration tests
* Avoid setting maxConcurrentShardRequests to 1
* Test all index descriptors defined in the Kibana plugin
2024-04-16 17:11:45 -04:00
shainaraskas
ac5f5640e5
[DOCS] Update tutorial to discourage editing managed ILM policies (#107074) 2024-04-16 14:55:55 -04:00
Carlos Delgado
75badc2f2f
Fix IpScriptFieldType CI - #106900 (#107440)
I've been tracing the problems with these tests (as the [first attempt I
made](https://github.com/elastic/elasticsearch/pull/107066) was
unrelated to the actual bug).

I discovered that the actual problem was that the `BytesRefHash` for
`terms` in the `IpScriptFieldTermsQuery` was not finding terms that were
actually there.

The seed that was used to reproduce this failure was triggering multiple
slices for performing the search. As `BytesRefHash` is not a threadsafe
class, that made me think about some kind of synchronization issue with
the underlying `BytesRefHash` structure for the
`IpScriptFieldTermsQuery`

Adding a `synchronized` block to the `terms` on access removed the
problem. I've tried to reproduce the issue with > 90k iterations of the
tests and have been unable to reproduce it.

Closes #106900
2024-04-16 14:48:53 -04:00
Armin Braun
05a25bfd3c
Avoid allocating 1k buffers for tiny slices/files in BlobCacheBufferedIndexInput (#107461)
Looking through some real world heap dumps, there's at times a lot of
instances of these things that have a 1k buffer allocated but are only a
couple of bytes in length. We can save tens of MB in examined cases by
just sizing the buffer smarter here.
2024-04-16 20:41:59 +02:00
Mark Tozzi
73a17a17fe
[ESQL] Moving argument compatibility checking for Equals (#107546)
Fixed the conflicts, and re-submitting. Please see #105217 for full details, history, and discussion. I'll use the commit message from that PR as well.

Continuing my work from #104490, this PR moves the parameter compatibility checking for Equals into the type resolution check. This is a somewhat bigger change than for Add, as there was no ES|QL base class for binary comparison operators before this. I've added EsqlBinaryComparison as that base class, and migrated all of the binary comparisons to be based off of that (except for NullEquals, see note below).

In order to maintain compatibility with the current behavior, I've kept it so that unsigned longs are only inter-operable with other unsigned longs. We've talked a lot about changing that, and I consider this work a prerequisite for that.

I've also added a bunch of test cases to Equals and NotEquals, which should have the side effect of filling out the type support table in the equals docs. As noted in the comments, I'll have follow up PRs for the other binary comparisons to add tests, but this PR is already too long.

Note about NullEquals: There is an ES|QL NullEquals class, which inherits from the QL version, but I don't think it works. I didn't see any tests or docs for it, and trying it out in the demo instance gave me a syntax error. I think we need to delve into what's going on there, but this PR isn't the right place for it.

This reverts commit 225edaf607.
2024-04-16 14:25:21 -04:00
Chris Hegarty
e6d421c830
Add release highlight for #106133 (#107487)
This commit adds a release highlight for #106133.
2024-04-16 18:25:49 +01:00
Ignacio Vera
ecacb2effb
Consider total number of aggregations not number of non-empty aggregations (#107536)
Test are failing because we are computing incorrectly the doc count error for terms aggregation. 
The only difference with the previous versions is that we are considering the number of empty aggregations
instead of the total number of aggregations when computing this value. Making this
change it makes the test happy.
2024-04-16 18:46:20 +02:00