Commit Graph

287 Commits

Author SHA1 Message Date
Hendrik Muhs fb0846a23d
[Transform][Rollup] remove unnecessary list indirection (#75459)
Remove an unnecessary indirection and refactor progress tracking. Both rollup and transform
process documents as stream, however in the AsyncTwoPhaseIndexer takes a List of index
requests. This change removes the unnecessary temporary container and makes upcoming
transform enhancements easier.
2021-07-28 16:34:17 +02:00
Hendrik Muhs 4e8301e8b7
[Transform] Fix transform fails when getting field mappings (#75694)
move field mapping retrieval from task startup into indexer

fixes #75693
2021-07-27 11:50:26 +02:00
Hendrik Muhs fc37cfc8b9
[Transform] fix listener for search context missing exception (#75615)
Fix a unreleased regression introduced in #74984. In case a pit search context disappeared the listener was called twice and the transform fails.
2021-07-22 11:00:28 +02:00
Hendrik Muhs 383fbd8e07
[Transform] Optimize composite agg execution using ordered groupings (#75424)
Automatically reorder group_by for composite aggs, ensuring date histogram
group by comes first. The order is only changed for execution, the provided
config remains unchanged.

In case of 2 group_by's of the same order type, the configuration order is
respected. Script and runtime field based group_by's are penalized.
2021-07-20 09:19:28 +02:00
Hendrik Muhs 15a3b3541d
[Transform] improve performance by using point in time API for search (#74984)
Use point in time API for every checkpoint in transform. Using point in time reduces pressure
on the source indexes, e.g. less refreshes. In case, pit isn't supported (e.g. when searching
remote clusters) it falls back to ordinary search requests as before.

closes #73481
2021-07-14 12:00:49 +02:00
Przemysław Witek 232921f62a
Add logging of shard failures (#75275) 2021-07-14 11:00:11 +02:00
Rene Groeschke 1db75f75ca
Polish and cleanup test related plugins (#74673)
- avoid eagerly created test cluster
- remove duplicate superflous configuration
- resolve system properties via provider factory
- move common test configuration / setup into rest test base plugin
2021-07-05 10:34:36 +02:00
Rene Groeschke d8e4e48a3b
Avoid creating unused test tasks (#74644)
With the overall theme of trying to configure and add less to the build instead of just disabling it later,
we're replacing standalone-test by standalone-rest tasks avoids creating the
unused test tasks.

Standalone rest test plugin and the other rest test plugins behave a little bit different in the sense how source sets and test tasks are wired.

The standalone rest test plugin assumes that all RestTestTasks are using the same sourceSet (test). The yaml, java Rest test plugins use one dedicated sourceSet per test task.

In the long run we probably will migrate standalone-rest-test usages to one of the other plugins and deprecate standalone-rest-test
2021-06-30 14:11:25 +02:00
Rene Groeschke 54738fc067
Avoid unused sourcesets and tasks in javaRestTest plugin (#74492)
We only need the javaRestTest sourceSet and can avoid main and test sourceSet by
just using the new introduced ElasticsearchJavaBase instead of ElasticsearchJava plugin
2021-06-28 09:54:59 +02:00
Rene Groeschke b79dd52c1b
Cleanup QA projects build scripts (#74428)
Aiming for configuring less during the build,
this removes non required configuration from qa build scripts that do not
contain any sources. We also remove a few non required afterEvaluate hooks
2021-06-23 11:35:47 +02:00
Hendrik Muhs d51b995f3a
[Transform] optmize histogam group_by change detection (#74031)
implement a simple change optimization for histograms using min and max aggregations. The
optimization is not applied if the range cutoff would be too small compared to the overall
range from previous checkpoints. At least 20% must be cut compared to former checkpoints.

fixes #63801
2021-06-14 16:44:36 +02:00
Przemysław Witek 602fb449b1
[Transform] Small cleanup in transform indexer code (#73891) 2021-06-10 08:32:26 +02:00
Ryan Ernst 63012c8a40
Move ParseField to o.e.c.xcontent (#73923)
ParseField is part of the x-content lib, yet it doesn't exist under the
same root package as the rest of the lib. This commit moves the class to
the appropriate package.

relates #73784
2021-06-08 13:32:14 -07:00
Ryan Ernst 68817d7ca2
Rename o.e.common in libs/core to o.e.core (#73909)
When libs/core was created, several classes were moved from server's
o.e.common package, but they were not moved to a new package. Split
packages need to go away long term, so that Elasticsearch can even think
about modularization. This commit moves all the classes under o.e.common
in core to o.e.core.

relates #73784
2021-06-08 09:53:28 -07:00
William Brafford 953059c35b
Resolve concrete associated indices when resetting features (#73017)
When associated index patterns contained wildcards and
action.destructive_requires_name was set to true, feature resets were
failing. In order to avoid this, we want to resolve associated index
names, then pass the concrete index names to the delete request.

For normal system indices, the SystemIndexDescriptor provides a method
that searches cluster metadata for indices that match the the system
index pattern. This commit introduces an AssociatedIndexDescriptor that
provides the same mechanism. Although we could use an
IndexNameExpressionResolver for the associated indices, it makes sense
to me to keep things consistent across the various feature index pattern
collections.

This change has the effect of allowing the same regex-like syntax that
system index patterns can use, rather than just wildcards, in associated
index patterns.
2021-06-02 15:46:55 -04:00
Przemysław Witek 7e3f098dcf
[Transform] Revamp transform config and query validation code (#72526) 2021-05-26 13:49:54 +02:00
David Roberts 0216cf065b
[ML] Switch ML internal index templates to composable templates (#73232)
Legacy index templates are deprecated but ML was still using
them for its hidden indices.

This PR switches the legacy ML index templates to use the new
composable index template framework.

The composable index templates get installed once the master
node is on a version that understands them.  For templates
that need to be up-to-date in mixed version clusters where the
master might still be on a version that doesn't understand
composable index templates we still ship the legacy template
too, and install this if required in the mixed version cluster.
(The notifications index template falls into this category.)
This makes a couple of places in the code a little messy, as
the new style template definitions don't contain a dummy _doc
level (where the type used to be), but the legacy template
definitions do - hopefully we can tidy this up in master once
8.0 is released.

There is one more change of note in this PR that is not
strictly related to switching to composable templates, but
which was shown up during the testing.  We used to wait for
all templates to be installed by the master node before running
tests in mixed version clusters.  I do not believe we should
have been doing this, as other upgrade orchestration systems,
e.g. Cloud, will not be doing this.  Our production code needs
to install templates and/or mappings before any operation that
requires them if there's a chance that the elected master won't
have done this in time.

Fixes #65437
2021-05-24 11:13:24 +01:00
Przemysław Witek 51181d5d52
[Transform] Improve error message when user lacks privilege in _preview endpoint (#72002) 2021-05-12 15:06:03 +02:00
Hendrik Muhs ec92261293
[Transform] test with minimal privileges (#72816)
limit the privileges to the minimal required ones

relates #72715
2021-05-10 13:01:07 +02:00
Rene Groeschke e609e07cfe
Remove internal build logic from public build tool plugins (#72470)
Extract usage of internal API from TestClustersPlugin and PluginBuildPlugin and related plugins and build logic

This includes a refactoring of ElasticsearchDistribution to handle types
better in a way we can differentiate between supported Elasticsearch
Distribution types supported in TestCkustersPlugin and types only supported
in internal plugins.

It also introduces a set of internal versions of public plugins.

As part of this we also generate the plugin descriptors now.

As a follow up on this we can actually move these public used classes into 
an extra project (declared as included build)

We keep LoggedExec and VersionProperties effectively public And workaround for RestTestBase
2021-05-06 14:02:35 +02:00
Hendrik Muhs ca63643525
[Transform] fix 2 issues with index sort in integration test (#72742)
fix 2 corner cases in test setup: unsigned_long not support as index sort,do not overlay a runtime field with index sort

fixes #72733
relates #72692
2021-05-05 11:58:53 +02:00
Ignacio Vera 41241f69a2
mute TransformContinuousIT#testContinousEvents (#72734) 2021-05-05 09:24:11 +02:00
Hendrik Muhs 98db34907d
[Transform] unmute continuous transform testing on sorted indexes (#72692)
unmute continuous transform testing on sorted indexes. These extra
test randomness has been disabled due to triggered lucene assertions.
The upstream issue seems to have been fixed.
2021-05-04 17:55:57 +02:00
Hendrik Muhs 125726a0f2
[Transform] Fix rolling upgrade regression introduced in #72533 (#72666)
#72533 introduced a regression, causing transforms to timeout/fail.
With this change transform only waits for 1 active shard(primary) as waiting for all can block during
rolling upgrade

fixes #72617
relates #72533
2021-05-04 14:25:16 +02:00
Hendrik Muhs 918be1d501
[Transform] avoid transform failure during rolling upgrade (#72533)
ensure shards are searchable after creation of a new internal index version

fixes #72525
2021-04-30 15:28:28 +02:00
Lee Hinman 0f50800ecb
Don't assign persistent tasks to nodes shutting down (#72260)
This commit changes the `PersistentTasksClusterService` to limit nodes for a task to a subset of
nodes (candidates) that are not currently shutting down.

It does not yet cancel tasks that may already be running on the nodes that are shut down, that will
be added in a subsequent request.

Relates to #70338
2021-04-28 14:00:57 -06:00
William Brafford fc7c06d8a1
Make feature reset API response more informative (#71240)
Previously, the ResetFeatureStateStatus object captured its status in a
String, which meant that if we wanted to know if something succeeded or
failed, we'd have to parse information out of the string. This isn't a
good way of doing things.

I've introduced a SUCCESS/FAILURE enum for status constants, and added a
check for failures in the transport action. We return a 207 if some but not all
reset actions fail, and for every failure, we also return information about the
exception or error that caused it.

Co-authored-by: Jay Modi <jaymode@users.noreply.github.com>
2021-04-27 13:47:10 -04:00
Hendrik Muhs 7fff5df7a3
[Transform] add support for top metrics (#71850)
add support for the stats and top metrics aggregation in transform. With this change it became
easier to add more multi value aggregations to transform

Limitations:
 - only the 1st element of top_metrics gets consumed by transform[*].
 - all values of stats will be mapped to double if mapping deduction is used, including count,
   sum, min, max

fixes #52236
relates #51925
2021-04-27 13:45:53 +02:00
Przemysław Witek f992e47763
[Transform] Make transform _stats work again, even if there are no transform nodes (#72221) 2021-04-27 09:47:20 +02:00
Rene Groeschke 5bcd02cb4d
Restructure build tools java packages (#72030)
Related to #71593 we move all build logic that is for elasticsearch build only into
the org.elasticsearch.gradle.internal* packages

This makes it clearer if build logic is considered to be used by external projects
Ultimately we want to only expose TestCluster and PluginBuildPlugin logic
to third party plugin authors.

This is a very first step towards that direction.
2021-04-26 14:53:55 +02:00
Ayushman Singh Chauhan 4169587115
DOC: Fix spelling (#72179)
DOC: Fix spelling
2021-04-23 16:59:51 -04:00
Benjamin Trent 5e3d54b908
[ML] [Transform] use feature reset API for transform test cleanup (#72044)
This moves all transform cleanup logic to use the feature reset API.
2021-04-22 13:11:16 -04:00
Hendrik Muhs f3c175cc60
[Transform] enhance geobounds test for sparse data case (#72023)
use sparse data for geobounds agg, verifies the fix of #71874, adding debug
logging of index requests send by transform
2021-04-22 12:57:54 +02:00
Hendrik Muhs c7fb400b3f
[Transform] remove deprecated endpoint from tests (#71891)
remove the use of the deprecated _data_frame endpoint from rest test cases, because it can prevent detecting problems in PR builds

relates #71792
2021-04-20 10:35:23 +02:00
Przemysław Witek 319548c80c
Redirect transform actions to transform&remote_cluster_client node when needed (#70125) 2021-04-19 17:22:09 +02:00
Przemysław Witek 749120ed5b
[Transform] Add telemetry support for transform features (#71607) 2021-04-19 14:38:50 +02:00
Dan Hermann c831d887cb
Fix failure in TransformPivotRestSpecialCasesIT::testIndexTemplateMappingClash (#71778) 2021-04-19 07:34:12 -05:00
Henning Andersen 567c56e5fa
Mute testIndexTemplateMappingClash (#71810) 2021-04-19 08:14:10 +02:00
Benjamin Trent 33e23b747a
[ML] fix machine learning job close/kill race condition (#71656)
If a machine learning job is killed while it is attempting to open, there is a race condition that may cause it to not close.

This is most evident during the `reset_feature` API call. The reset feature API will kill the jobs, then call close quickly to wait for the persistent tasks to complete. 

But, if this is called while a job is attempting to be assigned to a node, there is a window where the process continues to start even though we attempted to kill and close it.

This commit locks the process context on `kill`, and sets the job to `closing`. This way if the process context is already locked (to start), we won't try to kill it until it is fully started.

Setting the job to `closing` allows the starting process to exit early if the `kill` command has already been completed (before the communicator was created).

closes https://github.com/elastic/elasticsearch/issues/71646
2021-04-14 13:50:06 -04:00
Lyudmila Fokina 3b0b7941ae
Warn users if security is implicitly disabled (#70114)
* Warn users if security is implicitly disabled

Elasticsearch has security features implicitly disabled by default for
Basic and Trial licenses, unless explicitly set in the configuration
file.
This may be good for onboarding, but it also lead to unintended insecure
 clusters.
 This change introduces clear warnings when security features are
 implicitly disabled.
 - a warning header in each REST response if security is implicitly
 disabled;
 - a log message during cluster boot.
2021-04-13 18:33:41 +02:00
David Roberts c4364584aa
[ML] Use feature reset API in ML REST test cleanup (#71552)
Now that we have a feature reset API, we should use
this for cleaning up in between tests instead of running
lots of bespoke cleanup code.

During testing of this change we found we need to
delete custom cluster state as part of the reset process,
so this PR also implements that.

Additionally we no longer assign persistent tasks
during feature reset.
2021-04-13 16:04:47 +01:00
Rene Groeschke 0f40889879
Update build to Gradle 7.0 (#68506)
- Update gradle wrapper to gradle 7.0
- Remove deprecated usages to make build 7.0 compatible
- Fix excludes in docs snippet tasks (See https://github.com/gradle/gradle/issues/16160 for details)
- Fix deprecation warnings in 7.0
- Add explicit dependencies that have been missed
- Make extract native licenses tasks output dir more explicit
- Use a snapshot of the ospackage plugin that includes a fix for 7.0 already
- fix test runtime classpath setup in repository-hdfs
- Make task dependency explicit to fix further deprecation warnings
- Remove manual check for http repo usages that has been deprecated in gradle 7.0
- Update spock to latest 2.0 milestone required for groovy 3
2021-04-13 09:15:08 +02:00
Jason Tedor 241b653ae4
Move machine learning roles to server (#71412)
This commit moves the machine learning roles to server. We no longer
need to maintain these roles outside of server since we only produce a
single distribution, the default distribution, which includes all
roles. Therefore we can simplify the plugin architecture by removing the
plugin extension point for roles. This is one step in that, by moving
the machine learning roles to server.
2021-04-07 19:25:36 -04:00
Benjamin Trent 55c7cbcb4a
[Transform] finalize feature reset integration (#71133)
This commit updates transform feature reset to:

- wait for transform tasks to complete
- wait for all indexing actions to transform indices to complete
- and prevents transform audit messages from being written while the reset is being processed

related to https://github.com/elastic/elasticsearch/issues/70008 & https://github.com/elastic/elasticsearch/issues/69581
2021-04-07 11:00:32 -04:00
Hendrik Muhs 433ce509d1
[Transform] introduce more transform schema tests (#70859)
add more json schema definitions for transform API's/objects
2021-04-06 16:37:44 +02:00
Jason Tedor a5a5278954
Remove legacy role settings (#71163)
This commit removes the previously deprecated legacy role
settings. These settings have been replaced by node.roles.
2021-04-01 19:31:55 -04:00
Jim Ferenczi fa88a46b9c
Expose if a field is a metadata field in the field capabilities response (#69977)
This change exposes for each field in the _field_caps response if the field is a metadata field.
This is needed for consumers of this API that want to filter these fields. Currently ML keeps a static list
and QL checks that the family type starts with `_`. In order to ease the addition of new metadata fields, this
change reworks the strategy in this solution and now only checks for the new flag.
Note that the new flag is also applied at the coordinator level in a best-effort to apply the logic on older nodes
in a mixed-version cluster.
2021-03-30 12:13:03 +02:00
Hendrik Muhs cc28159eb0
[Transform] make shouldStopAtCheckpoint more robust (#70461)
shouldStopAtCheckpoint tells transform to stop at the next checkpoint, if
this API is called while a checkpoint is finishing, it can cause a race condition
in state persistence. This is similar to #69551, but this time in a different
place.

With this change _stop?shouldStopAtCheckpoint=true does not call doSaveState
if indexer is shutting down. Still it ensures the job stops after the indexer has
shutdown. Apart from that the change fixes: a logging problem, it adds error
handling in case of a timeout during _stop?shouldStopAtCheckpoint=true. Some
logic has been moved from the task to the indexer.

fixes #70416
2021-03-22 11:28:27 +01:00
William Brafford 624ee45a8e
Add API for resetting state of a `SystemIndexPlugin` (#69469)
When we disable access to system indices, plugins will still need
a way to erase their state. The obvious and most pressing use
case for this is in tests, which need to be able to clean up the
state of a cluster in between groups of tests.

* Use a HandledTransportAction for reset action

My initial cut used a TransportMasterNodeAction, which requires code
that carefully manipulates cluster state. At least for the first cut and
testing, it seems like it will be much easier to use a client within a
HandledTransportAction, which effectively makes the
TransportResetFeatureStateAction a class that dispatches other transport
actions to do the real work.

* Clean up code by using a GroupedActionListener

* ML feature state cleaner

* Implement Transform feature state reset

* Change _features/reset path to _features/_reset

Out of an abundance of caution, I think the "reset" part of this path
should have a leading underscore, so that if there's ever a reason to
implement "GET _features/<feature_id>" we won't have to worry about
distinguishing "reset" from a feature name.

Co-authored-by: Gordon Brown <gordon.brown@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-03-17 16:14:34 -04:00
Hendrik Muhs 03510c374f
[Transform] fix itermittent problem in TransformIndexerTests/TransformIndexerFailureHandlingTests (#70326)
fix a race condition in the test: the indexer thread might still be in the
process of shutting down, when the test thread triggers it again.

relates #69551
fixes #70297
2021-03-15 11:41:18 +01:00