Commit Graph

62330 Commits

Author SHA1 Message Date
Rene Groeschke 96329ef1bc
Sort build benchmark scenarios to make easier to read 2022-01-05 15:16:26 +01:00
Andrei Dan f18c9c503e
Migrate to data tiers API dry run on any ILM status (#82226)
The migrate to data tiers routing API required ILM to be stopped. This
is fine for "live" runs, but for dry runs this isn't a requirement.

This changes the dry_run to allow the API to run irrespective of the ILM
status.
2022-01-05 13:40:27 +00:00
Rene Groeschke d84b875698
Update checkstyle to latest 8.x release (#82186)
- Updates checkstyle to 8.45.1

- This was update was triggered by us running into checkstyle/checkstyle#9897 We do not update to latest 9.x release yet as we see a performance decrease when running precommit with this. likely related to checkstyle/checkstyle#10934
2022-01-05 12:45:51 +01:00
Ievgen Degtiarenko be4ff31a25
Perform index checking in a caller thread (#82249)
Since 8.11 lucene performs index checking concurrently
using disposable fixed thread pool executor by default.
Setting thread count to 1 to keep prior behavior
(check is executed in single caller thread).
2022-01-05 12:19:41 +01:00
Andrei Dan 332e6d48c4
Data tiers: migrate the coldest node attribute (#81940)
This fixes the migrate to data tiers routing API to take into account
the scenario where the node attribute configuration for an index is more
accurate than the existing `_tier_preference` configuration.

Previously we would simply remove the node attributes routing if there
was a `_tier_preference` configured for the index.

With this commit, we'll look if either the `require.data` or
`include.data` custom routings are colder than the existing `_tier_preference`
configuration (ie. `cold` vs `data_warm,data_hot`) and update the tier
routing accordingly.

eg.
{
  index.routing.allocation.require.data: "warm",
  index.routing.allocation.include.data: "cold",
  index.routing.allocation.include._tier_preference: "data_hot"
}
will be migrated to:
{
  index.routing.allocation.include._tier_preference: "data_cold,data_warm,data_hot"
}

This also removes the existing invariant that had the `require.data`
configuration take precedence over a possible `include.data`
configuration, and will now migrate the coldest configuration to the
corresponding `_tier_preference`.

eg.
{
  index.routing.allocation.require.data: "warm",
  index.routing.allocation.include.data: "cold"
}
will be migrated to:
{
  index.routing.allocation.include._tier_preference: "data_cold,data_warm,data_hot"
}
2022-01-05 09:56:37 +00:00
Yannick Welsch bb8578b301
Check older source-only repos are supported (#82213)
Checks that archive functionality works with source-only repositories.

Relates #80160
2022-01-05 10:39:10 +01:00
Tim Vernum cb40354d87
Add explicit "roles.yml" support to testclusters (#82137)
Previously, within tests, the file "roles.yml" (that is used to define
security roles in a cluster) would need to be configured using
`extraConfigFile`. This is effective, but means that there can only be
a single source of security roles for the testcluster.

This change introduces an explicit "securityRoles" setting in
testclusters that will concatenate the provided files into a single
"roles.yml" in the config directory. This makes it possible for
testclusters itself to define standard roles as well as having each
test define additional roles it may need.

Relates: #81400
2022-01-05 16:27:32 +11:00
Tim Vernum 1e570620bf
Allow read template with cluster monitor privilege (#82046)
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
https://github.com/elastic/beats/issues/29554 Relates: #78832
2022-01-04 21:37:46 -05:00
Stuart Tettemer 57ac810951
Script: track this pointer capture from blocks within lambdas (#82228)
* Script: track this pointer capture from blocks within lambdas

If a lambda contains a block that calls into a user function,
the painless compiler was not tracking that the lambda needs
to capture the `this` pointer.

Scripts that attempted to use a lambda that calls a user
function from inside a block would trigger an
`illegal_state_exception`:

> no 'this' pointer within static method

`BlockScope` now forwards `setUsesInstanceMethod` calls to
it's parent, which may be a `LambdaScope`.

`LambdaScope` will also forward `setUsesInstanceMethod` to
it's parent after setting it's own `usesInstanceMethod` flag,
propagating `this` pointer capture in the case of nested lambdas.

Fixes: #82224
2022-01-04 15:14:51 -06:00
Jake Landis fe7f0c5f5d
Fix Watcher testWatcherWithApiKey (#82136)
Bump the timeout allowed for a Watch to execute.

closes #77026
2022-01-04 14:42:19 -06:00
Mark Vieira a72817c87b Mute InternalTestClusterTests.testBeforeTest 2022-01-04 10:53:29 -08:00
Mark Vieira 76b9255bb3
Ignore errors syncing ephemeral files in test clusters (#82154) 2022-01-04 09:55:35 -08:00
Stef Nestor 9fd280b67e
[DOC] Don't include searchable snapshot ILM action in both hot and cold phases (#82013)
As outlined in elastic/elasticsearch#81604, including the `searchable_snapshot` action in both the hot and cold phases can result in indices not automatically migrating to the cold tier during the cold phase.

This adds a related warning.

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
2022-01-04 12:37:05 -05:00
Jack Conradson 60e08fdff1
Add support for GeoShape to the scripting fields API (#81617)
This change adds infrastructure for GeoShape making it accessible via the new scripting fields API. 
This does not add any methods outside of get at this point in time since it needs additional 
thought/discussion on what makes sense similar to GeoPoints. Note that because GeoShape does 
not support XContent this is just a skeleton that currently supports getScriptDocValues.
2022-01-04 08:55:46 -08:00
Armin Braun c6786dc20a
Don't Parse Monitoring Templates on Every CS Update (#82203)
Same as #80086 fixing the monitoring templates which that original
PR forgot.

Relates #77466
2022-01-04 17:18:33 +01:00
Jake Landis 78723a3073
Re-enable SingleNodeTests.testThatLoadingWithNonExistingIndexWorks (#82118)
The PR re-enables a test that has been muted for a while.
A few improvements have been made that are suspected
to allow this test to pass now. Also, the timeout has been
bumped up to help with the stability of this test.

closes #54096
2022-01-04 10:15:51 -06:00
Jake Landis fd6f04bb24
[docs] clarify purged http stats (#82123) 2022-01-04 09:51:41 -06:00
Jake Landis 912cf94fff
Watcher fix ActivateWatchTests (#82157)
This commit attempts to fix a set of Watcher tests that can
fail due to unexpected execution of Watches after Watcher has been stopped.

The theory here is that a Watch can be queued but not fully executed
then Watcher is shutdown, the test does some clean up, then the
queued Watch finishes execution and causes some some additional cleanup
to fail.

The change here ensures that when Watcher is stopped from AbstractWatcherIntegrationTestCase
that it will also wait until there are no more current Watches executing.

closes #66495
2022-01-04 09:42:58 -06:00
Jake Landis 550eb325dc
Fix Watcher test 'testVars' (#82135)
The error that caused his test be muted is
java.lang.AssertionError: Count is 2 hits but 1 was expected.
from: assertHitCount(searchResponse, 1L);
when searching for watch records.

It is believed this is due to the cron scheduler executing a
second watch. The change here is to use a long interval
schedule instead of the cron scheduler.

Fixes #67908
2022-01-04 09:41:35 -06:00
Sylvain Wallez 8ab0d40cb5
Fix version resolution and encoding in LLRC (#81989) 2022-01-04 15:15:39 +01:00
James Rodewig f5f76ff1ca
[DOCS] Note that `default_field` support wildcards (#81127)
Changes:

* Notes that the query string query's `default_field` and `fields` parameters support wildcards.
* Adds an xref to the `index.query.default_field` docs to the `default_field` parameter.
2022-01-04 08:26:13 -05:00
Przemysław Witek e9af7c608f
[Transform] Report _preview warning in the face of pipeline failure. (#81972) 2022-01-04 14:25:12 +01:00
Andrei Dan c813bd995d
ILM: fix allocate action to allow only total_shards_per_node (#81944)
The allocate action can specify only `number_of_replicas` (without
routing configuration) but failed if it attempted to only specify
`total_shards_per_node`.

This fixes the action to allow specifying only `total_shards_per_node`.
2022-01-04 11:55:03 +00:00
Armin Braun a17e0786fe
Simplify MappingMetadata Field in IndexMetadata (#82187)
We only have a single entry in the map nowadays so the map is redundant
and has become a performance issue now that we do mapping deduplication
when building `Metadata`. Calls to this getter make up more 5%+ of the
master thread runtime in many shards benchmarking because of the expensive
iterator setup.
Unfortunately, it wasn't quite as easy to adjust the wire format here
since we need to still communicate with older version nodes that will
send a map diff so I left that as a TODO as it's low-impact/priority
and this change fixes the performance issue for now.
2022-01-04 12:41:21 +01:00
David Turner 641a01b357
Paginate persisted cluster state (#78875)
Today we allocate a contiguous chunk of memory for the global metadata
each time we write it to disk. The size of this chunk is unbounded and
in practice it can be pretty large. This commit splits the metadata
document up into pages (1MB by default) that are streamed to disk at
write time, bounding the memory usage of cluster state persistence.
Since the memory usage is now bounded we can allocate a single buffer up
front and re-use it for every write.
2022-01-04 06:05:58 -05:00
Costin Leau ec57fbec6f
SQL: Remove JDBC dependency on ES lib geo (#82166)
As part of the effort of making JDBC driver self sufficient, remove the
ES lib geo dependencies without any replacement.
Currently the JDBC driver takes the WKT text and instantiates a geo
object based on the ES lib geo.
Moving forward the driver will return the WKT string representation
without any conversion letting the user pick the geo library desired.
That can be ES lib geo, jts, spatial4j or others.

Note this is a breaking change.

Relates #80277
2022-01-04 07:55:41 +02:00
Armin Braun 704d8ca4a3
Fix Noisy Warnings in SecurityIntegTestCase (#82103)
Adding the mapper extras plugin to avoid endless warnings about a
missing scaled_float mapper in these tests.
Also, removed some unrelated dead code that wasn't really worth a separate PR.
2022-01-03 18:50:53 +01:00
Armin Braun 73c66197bc
More Efficient Simple String List Setting (#82168)
For string lists there is no need to parse an existing list after serializing
it. Also, if there's no fallback settings and/or validation and just a constant
default, we can pass through that default outright instead of serializing and
deserializing it to make a copy.

This is motivated by finding lots of duplicate strings on heap for the default
query fields list on data nodes holding many indices with Beats mappings which
I tracked down to the fact that we are not passing through the list containing
deduplicated strings from the `Settings` instance.
2022-01-01 15:50:52 +01:00
Costin Leau dc1e28b8b4 SQL: Allow x-content transitive dependencies
Tweak the dependencies - take 2
Relates #82077
2021-12-31 17:36:28 +02:00
Costin Leau 4d5a12321c SQL: Allow x-content transitive dependencies
Relates #82077
2021-12-31 17:25:26 +02:00
Kevin Lacabane 60eef9dd8f
stack monitoring: update logstash mappings (#82152)
* stack monitoring: update logstash mappings

* missing properties
2021-12-31 16:14:07 +01:00
Costin Leau 16af5dcc6e SQL: Fix thirdParty audit in sql-action
Relates #82077
2021-12-31 16:06:24 +02:00
Costin Leau 649fb189d7
Remove JDBC dependency on ES lib core (#82162)
As part of the effort of making JDBC driver self sufficient, remove the
ES lib core dependencies by light cloning the couple the utility classes
needed (and their dependencies).
In additional provide a shim layer that adapts the sql-proto Protocol
constant class by introducing a sql-action Protocol class, which is ES
aware.
To avoid name collision sql-proto has been renamed to CoreProtocol which
is used at the driver level, while Protocol is used within ES.

Relates #82077
2021-12-31 15:13:59 +02:00
Armin Braun c0b8ba7607
Use String Intern Cache when Constructing DiscoveryNode (#82105)
Use string intern cache when constructing discovery node instances.
These started showing up in profiling now here and there, likely
due to the fact that we're interning more strings via setting string
interning now. Using the deduplicator makes them disappear from profiling again
for the most part.
Also, fix the fact that we would read a mutable `attributes` map if there's
any attributes and escape it via a getter and intern the attribute keys and values
from the wire as well because it's pretty much free to do so now anyway.
2021-12-31 13:01:28 +01:00
Jake Landis 689620f2d6
Watcher fix testTriggeredWatchLoading (#82155)
In all reported cases it appears that the found count is > expected
count.  It is suspected that there are some Watches from previous tests
still pending in the .triggered_watches index causing extra Watches to
be executed. The change here is to ensure that .triggered_watches is
removed prior to the  test run ensuing a clean slate.  closes #67729
2021-12-30 15:49:01 -05:00
Armin Braun 76e7b6b357
Fix Failing TranslogTests.testRecoveryFromFailureOnTrimming (#82148)
In #77674 the assertion that is moved here was added.
The problem with it is that when running tests that do
random IO exceptions on the `channel.position()` call,
the assertion actual has a side effect.
If the exception it triggers as a side effect is not caught and
the translog failed as a result, tests around the safety of handling
IOExceptions in this code fail. Unfortunately, the assertion still
has a side effect after this change but its side effect is handled
like an expected IOException.
2021-12-30 17:21:08 +01:00
Jake Landis d66a6accb1
Add EQL REST tests to rest resources artifact (#82094) 2021-12-30 09:46:08 -06:00
Nik Everett 96fe3d08b7
Fix GetFieldMappingsResponseTests (#82147)
The new `testConcurrentToXContent` wasn't respecting the built in
`getToXContentParams` used to customize how we render in tests.
2021-12-30 10:34:08 -05:00
Armin Braun adb54120d3
Skip Redundant Writes and Fsyncs in TranslogWriter (#77674)
There are a number of situations where we don't write anything to the
channel so we can skip the empty write and fsync to save some syscalls.
2021-12-30 15:22:16 +01:00
Tim Vernum 0942444325
Fix docs and error message for role field_security (#81283)
In the index permission block of a role descriptor, the "field_security"
field is an object with this format:     "field_security": {       
"grant" : [ "field-1", "field-2", "more-fields-*" ],        "except" : [
"more-field-secret-*" ]     } The docs incorrectly stated that
"field_security" was a list, and if you provided a list the parser would
fail with a message that incorrectly stated that START_ARRAY was an
acceptable token. These have both been fixed. While reviewing the test
cases for RoleDescriptor, I also introduced more randomisation to
increase the overall coverage of features and scenarios.
2021-12-30 04:56:42 -05:00
Costin Leau aa7df5387a
Make SQL CLI slimmer (#82133)
* Remove sql-action dependency from sql-cli

The CLI only uses the basic formatter in sql-action but without touching
the serialization or response items from it.
Extract just the formatting bits into sql-proto (used already) and keep
the serialization bits inside sql-action.
This should make the CLI jar significantly smaller since all the server
dependencies are removed.

Fix #82076
2021-12-30 11:20:42 +02:00
Aleksandr Maus febf9aaa4e
Add "maintenance" permission to the fleet-server service account (#82125)
* Add "maintenance" permission to the fleet-server service account

* Fix tests
2021-12-29 21:47:16 -05:00
Nik Everett 03958142b6
Fix cardinality agg in async search (#82108)
Async search reads aggregation results on many threads. It's quite
possible for it to concurrently serialize an aggregation and render
it's xcontent. But the cardinality agg's results were not thread safe!
They reuse non-thread safe shard constructs used to collect the agg.
It's fine for the collection side not to be thread safe. But not
results.

Anyway! This would sometimes cause the async search index to contain
invalid results which would fail to deserialize. This seems to happen
frequently enough to some folks that it makes cardinality totally
unusable with async search. So far as I can tell you have to create a
race on the iterator to make that happen. This is enough:
```
curl -XDELETE -uelastic:password localhost:9200/test
echo
for i in {1..100}; do
  rm -f /tmp/bulk
  printf "%03d:  " $i
  for j in {1..10000}; do
    echo '{"index": {}}' >> /tmp/bulk
    echo '{"i": '$i', "j": '$j'}' >> /tmp/bulk
  done
  curl -s -XPOST -HContent-Type:application/json -uelastic:password localhost:9200/test/_bulk?pretty --data-binary @/tmp/bulk | grep error
done

while true; do
  id=$(curl -s -XPOST -HContent-Type:application/json -uelastic:password 'localhost:9200/test/_async_search?pretty&request_cache=false&wait_for_completion_timeout=10ms' -d'{
    "size": 0,
    "aggs": {
      "i": {
        "terms": {
          "field": "i"
        },
        "aggs": {
          "j": {
            "cardinality": {
              "field": "j"
            }
          }
        }
      }
    }
  }' | jq -r .id)

  while curl -s -HContent-Type:application/json -uelastic:password localhost:9200/_async_search/$id?pretty | tee out | grep '"is_running" : true'; do
    cat out
  done
  cat out

  sleep 1
  curl --fail-with-body -s -HContent-Type:application/json -uelastic:password localhost:9200/_async_search/$id?pretty || break
done
```

Run that without this PR and it'll break with a message about being
unable to deserialize stuff from the index. It'll give a 400 error too
which is totally bogus. On my laptop it takes less than ten iterations
of the loop.

So this PR fixes it! It removes the non-thread safe stuff from the
cardinality results. It also adds a half dozen extra unit tests that'll
be run for hundreds of objects which should catch similar sorts of
possible errors.
2021-12-29 15:20:51 -05:00
Albert Zaharovits 5ec532b6b0
Introduce domain setting to associate realms (#81968)
Introduces a new series of node settings
`xpack.security.authc.domains.<domain_name>.realms: <realm_name_list>`.
The setting sets the `domain` property on `Realm` and `RealmConfig`
instances. The domain property ought be subsequently used in order to
determine if two identical `usernames` are the same personas, and hence
can share ownership (of profiles, keys, tokens, scrolls), even though
they authenticated via different realms (but which are associated under
the same domain).
2021-12-29 14:12:54 -05:00
Albert Zaharovits 9e9a8cc7d0
Auto-generated TLS files under fixed config path (#81547)
We (mostly I) were initially advocating for the auto-generated files to
use unique names (the name containing a timestamp particle), in order to
avoid that subsequent invocations of the config step conflict with
itself. Moreover, I was wishing that these files will not have to be
handled directly by admins (that the enrollment process was to be used).
However, experience proved us otherwise, admins have to manipulate these
files, and unique configuration names are hard to deal with in scripts
and docs, so this PR is all about using a fixed name for all the
generated files. _Labeling as a bug fix because the feedback is that it
very negatively impacts usabilty._ Closes
https://github.com/elastic/elasticsearch/issues/81057
2021-12-29 12:56:29 -05:00
Mark Vieira 5af31cdbd1 Temporarily disable testing Amazon linux 2021-12-29 09:39:44 -08:00
Igor Motov d9927f2c03
Fix TimeSeriesMetricsIT test (#82119)
Makes test data more realistic. We shouldn't more than one record that share
the same dimensions and timestamp.

Supersedes #81962
Closes #81807
2021-12-29 05:57:19 -10:00
Costin Leau dddff27498
Upgrade to log4j 2.17.1 (#82111)
Upgrade to log4j 2.17.1
2021-12-28 23:33:07 +02:00
Armin Braun 01debdc856
Deduplicate Shard Started Requests (#82089)
Deduplicate shard started requests the same way we deduplicate shard-failed
and shard snapshot state updates already.

closes #81628
2021-12-28 19:02:35 +01:00
Lisa Cawley 0a1851353a
Update using.asciidoc (#81896) (#82097)
Co-authored-by: Majid Alaeinia <11965368+majidalaeinia@users.noreply.github.com>
2021-12-27 12:51:21 -08:00