Commit Graph

5215 Commits

Author SHA1 Message Date
Martijn van Groningen 51662c83eb [TEST] If bulk item failed then log why.
Original commit: elastic/x-pack-elasticsearch@e7cc96460d
2017-04-03 13:49:43 +02:00
David Kyle 622c5ae166 [ML] Remove JobManagers dependency on JobResultsPerister (elastic/x-pack-elasticsearch#915)
* Remove JobManagers dependency on JobResultsPerister

* Remove unneeded call to refresh the state index

Original commit: elastic/x-pack-elasticsearch@0b2351bba7
2017-04-03 12:00:52 +01:00
David Roberts 2d01c3884b [ML] Don't get stats for jobs that are being deleted (elastic/x-pack-elasticsearch#899)
If jobs are being deleted then the operations required to get stats
could fail with unexpected exceptions.  When stats for multiple jobs
were being requested, this would previously cause the whole operation
to fail.

This commit changes the stats endpoint to ignore jobs that are being
deleted.

Fixes elastic/prelert-legacy#837

Original commit: elastic/x-pack-elasticsearch@6ac141a987
2017-04-03 11:04:34 +01:00
David Roberts c5a2fba70a [ML] Ignore ResourceNotFoundException executing C++ process update (elastic/x-pack-elasticsearch#927)
When this happens it means the job has been deleted, which in turn means
the C++ process has been stopped, so there's no need to send it a message
and hence no problem worth logging a stack trace for.

This differs from elastic/x-pack-elasticsearch#896 because elastic/x-pack-elasticsearch#896 was for a similar situation with
closed jobs, whereas this one is for deleted jobs.

Original commit: elastic/x-pack-elasticsearch@9bb4e98fe7
2017-04-03 10:53:32 +01:00
David Kyle 30745b8dd7 [ML] Wait for model snapshot update when closing the results processor (elastic/x-pack-elasticsearch#916)
* [ML] Wait for model snapshot update when closing the results processor

* Review comments

Original commit: elastic/x-pack-elasticsearch@eeb6c3b8d8
2017-04-03 10:01:21 +01:00
Tanguy Leroux 73ddc2323b [Test] Relax LocalExporterTests on node_stats checks
The test is too rigid on checking the right number of node_stats documented that are collected. It happens if a node takes time to start, the node_stats count % numNodes will always be different than 0.

It also adds more logging for LocalBulk failures.

Original commit: elastic/x-pack-elasticsearch@1ebb20b6f6
2017-04-03 10:36:12 +02:00
Simon Willnauer 5e6bfb9a82 Fix cross cluster search with security (elastic/x-pack-elasticsearch#904)
This commit adds an integration test that runs basic cross cluster search
actions across 2 clusters with security installed. This commit also fixes
several issues with respect to internal actions and proxy actions in the context
of cross cluster search.

Relates to elastic/elasticsearch#23830
relates elastic/x-pack-elasticsearch#892

Original commit: elastic/x-pack-elasticsearch@2e5486c259
2017-04-03 09:53:48 +02:00
Igor Motov 4115336f5a Persistent Tasks: require correct allocation id for status updates (elastic/x-pack-elasticsearch#923)
In order to prevent tasks state updates by stale executors, this commit adds a check for correct allocation id during status update operation.

Original commit: elastic/x-pack-elasticsearch@b94eb0e863
2017-04-01 18:17:07 -04:00
Tanguy Leroux b5a285fd83 [Monitoring] Update LocalExporterTests (elastic/x-pack-elasticsearch#835)
This commit changes the LocalExporterTests so that it now test
various randomized cases in a single test. This should speed up
the test as well as minimize the failures due to multiple start
/stop of the exporter. It also uses the MonitoringBulk API
instead of calling the Exporter instances, which makes more sense
since it is the normal way to index monitoring documents.

Related  elastic/x-pack-elasticsearch#416

Original commit: elastic/x-pack-elasticsearch@f8a4af15cd
2017-04-01 10:42:09 +02:00
Ryan Ernst e1949ee362 Test: Use separate wrapper tasks for tribe clusters setup (elastic/x-pack-elasticsearch#905)
This commit adds separate tasks for tribe clusteres which the
cluster formation tasks build their own tasks off. This ensures each
cluster will have its own wait task, so that the tribe node will be able
to wait on the other clusters being up before even trying to start.

relates elastic/x-pack-elasticsearch#877

Original commit: elastic/x-pack-elasticsearch@1e4c729372
2017-03-31 14:30:44 -07:00
Chris Earle 16d963b8e3 [Monitoring] Use 'index_patterns' instead of 'template' (elastic/x-pack-elasticsearch#883)
Original commit: elastic/x-pack-elasticsearch@f1a217b597
2017-03-31 17:17:02 -04:00
Igor Motov d7e4390490 Persistent Tasks: Add waitForPersistentTaskStatus method (elastic/x-pack-elasticsearch#901)
This method allows to wait for tasks to change their status to match the supplied predicate.

Original commit: elastic/x-pack-elasticsearch@9f5d4104a0
2017-03-31 16:05:34 -04:00
Jim Ferenczi 232190df97 Fix field_caps handler expectations
Original commit: elastic/x-pack-elasticsearch@628b96bf4b
2017-03-31 18:49:11 +02:00
lcawl 436706f851 [DOCS] Create "en" translation directory (elastic/x-pack-elasticsearch#907)
Confirmed with @debadair, going ahead with merge

Original commit: elastic/x-pack-elasticsearch@c510ddfe9e
2017-03-31 08:48:39 -07:00
Jim Ferenczi 2b9ea83eca Add new field_caps API to the list of known actions and handlers
Original commit: elastic/x-pack-elasticsearch@126b369e1e
2017-03-31 16:52:43 +02:00
David Kyle 461bf314fa [ML] Clear bulk requests after execution (elastic/x-pack-elasticsearch#912)
Original commit: elastic/x-pack-elasticsearch@31a4c7e99a
2017-03-31 15:37:01 +01:00
Martijn van Groningen 878c7a4eb9 [ML] Set the correct close timeout
Original commit: elastic/x-pack-elasticsearch@aa0245cc28
2017-03-31 14:01:49 +02:00
David Kyle 9da2853d12 [ML] Hide AnalysisConfig.latency field if not set (elastic/x-pack-elasticsearch#895)
Original commit: elastic/x-pack-elasticsearch@b2b3567820
2017-03-31 12:08:44 +01:00
Alexander Reelsen d7f3a260fd HttpClient: Add support to limit response size (elastic/x-pack-elasticsearch#765)
In order to be stuck with big responses in the HttpClient, this commit
adds a maximum limit for the response. Defaults to 10MB, can be set to
50 MB max.

relates elastic/x-pack-elasticsearch#263

Original commit: elastic/x-pack-elasticsearch@05c449d4c1
2017-03-31 12:39:25 +02:00
David Roberts 95fd6777a0 [ML] Add 'xpack' into action names to match what the rest of X-Pack does (elastic/x-pack-elasticsearch#909)
Original commit: elastic/x-pack-elasticsearch@36be904ad9
2017-03-31 11:22:53 +01:00
David Roberts 23123b9219 [ML] Add extra Java-side detector validation (elastic/x-pack-elasticsearch#894)
Detector configs are validated both by our C++ and by our Java code.
If the C++ is stricter than the Java then error reporting is poor.
This commit adds two extra validation checks to the Java code that
were already present in the C++ validation.

relates elastic/x-pack-elasticsearch#856

Original commit: elastic/x-pack-elasticsearch@bd4ce2377c
2017-03-31 11:06:30 +01:00
David Roberts 21bac70d87 [ML] Don't log a stack trace when updating a non-open process (elastic/x-pack-elasticsearch#896)
It's possible for a C++ process to exit between the time when a
config update message for it is queued and the time that message
is processed.  This commit ensures we don't spam the log with a
stack trace in this situation, as it's not a problem at all.

relates elastic/x-pack-elasticsearch#891

Original commit: elastic/x-pack-elasticsearch@81af8eaf70
2017-03-31 10:56:46 +01:00
Dimitris Athanasiou 0cb2b18265 [ML] Implement cancellation policy for aggregated datafeeds (elastic/x-pack-elasticsearch#862)
Aggregated data extraction is done in 2 phases:

1. search
2. process response

The first phase cannot be currently cancelled. However, it usually
is the fastest of the two.

The second phase processes the histogram buckets in the search
response into flat JSON and then posts the result stream to the job.
This phase can be split into batches where a few buckets are posted
to the job at a time. Cancelling can then work between batches.

This commit changes the AggregationDataExtractor to process the
search response in batches. The definition of a batch is crucial
as it has to be short enough to allow for responsive cancelling,
yet long enough to minimise overhead due to multiple calls to the
post data action. The number of key-value pairs written by the
processor is a good candidate for a batch size measure. By testing,
1000 seems to be an effective number.

relates elastic/x-pack-elasticsearch#802

Original commit: elastic/x-pack-elasticsearch@ce3a172411
2017-03-31 10:15:43 +01:00
Martijn van Groningen cbfa5b5f0e [TEST] adjusted log levels in tests
Original commit: elastic/x-pack-elasticsearch@eb4e0c2450
2017-03-31 10:58:46 +02:00
Martijn van Groningen fb5ccc7d14 [TEST] increased log level
Original commit: elastic/x-pack-elasticsearch@a8ea83dca0
2017-03-31 10:44:06 +02:00
Martijn van Groningen b4bebfb12f [TEST] Increased timeout
Original commit: elastic/x-pack-elasticsearch@a7170e66dd
2017-03-31 10:34:51 +02:00
Martijn van Groningen aba4760b02 [ML] Fix native process threading protection and restructure ml threadpools
The native process can only handle one operation at a time, so in order the protect against multiple operation at a time (e.g. post data and flush or multiple post data operations) there should be protection in place to guarantee that at most only a single thread interacts with the native process. The current protection is broken when a job close is executed, more specifically the wait logic is broken here.

This commit changes the threading logic when interacting with the native process by using a custom `ExecutorService` that that uses a single worker thread from `ml_autodetect_process` thread pool to interact with the native process. Requests from the ml apis are initially being queued and this worker thread executes these requests one by one in the order they were specified.

Removed the general `ml` threadpool and replaced its usages with `ml_autodetect_process` or `management` threadpool.
Added a new threadpool just for (re)normalizer, so that these operations are isolated from other operations.

relates elastic/x-pack-elasticsearch#582

Original commit: elastic/x-pack-elasticsearch@ff0c8dce0b
2017-03-31 10:07:03 +02:00
Martijn van Groningen 7da4724b15 [ML] Start using AllocatedPersistentTask#updatePersistentStatus(...) instead of PersistentTasksService directly
Original commit: elastic/x-pack-elasticsearch@82a7db17e2
2017-03-31 08:28:40 +02:00
Martijn van Groningen 510be083de [TEST] Verify differently that job has closed due to invalid license
Original commit: elastic/x-pack-elasticsearch@70cc389ca7
2017-03-30 22:28:24 +02:00
Martijn van Groningen 93ee4104fb [TEST] increased logging
Original commit: elastic/x-pack-elasticsearch@4d5f35b9a6
2017-03-30 20:09:16 +02:00
Adrien Grand 52a7f956f4 Tests: Disable `ml/index_layout/Test unrelated index`.
Relates elastic/x-pack-elasticsearch#903

Original commit: elastic/x-pack-elasticsearch@097f559d0b
2017-03-30 19:00:50 +02:00
Simon Willnauer 3abe7a2058 Fix compilation issues after elastic/elasticsearch#23788
Original commit: elastic/x-pack-elasticsearch@ea24170b41
2017-03-30 15:00:41 +02:00
Martijn van Groningen f6d8f92d40 [ML] Use volatile boolean to stop blackhole process
Original commit: elastic/x-pack-elasticsearch@3788c7f0cf
2017-03-30 14:54:21 +02:00
Alexander Reelsen 5b2351fad0 Watcher: Improve assertion output in flaky test
The slack tests seem to fail periodically with not output
This commit tries to add some more verbose output by
making the query more broad and take failures into account
to uncover, what happens in this test.

Relates elastic/x-pack-elasticsearch#836

Original commit: elastic/x-pack-elasticsearch@e601b3a0df
2017-03-30 14:50:55 +02:00
Jason Tedor f52760d2ac Revert "Silence UpgradeClusterClientYamlTestSuiteIT"
This reverts commit elastic/x-pack-elasticsearch@e29f94b24c.

Original commit: elastic/x-pack-elasticsearch@d7d27b20ef
2017-03-30 08:39:10 -04:00
Alexander Reelsen dfc21c56be Watcher: Fix BasicSecurityTests.testWatcherMonitorRole
The test tried to create a watches index, that could have been
created by the test infrastructure already (to check if aliases
are supported).

relates elastic/x-pack-elasticsearch#837

Original commit: elastic/x-pack-elasticsearch@29714b2368
2017-03-30 14:03:37 +02:00
David Roberts f49dee89cb [TEST] Adjust expected error message
This was forgotten in elastic/x-pack-elasticsearch@2dbe41caaa

Original commit: elastic/x-pack-elasticsearch@8f7c4c32f4
2017-03-30 11:56:36 +01:00
Dimitris Athanasiou d33bce2ed2 [ML] Add job closing notification (elastic/x-pack-elasticsearch#893)
relates elastic/x-pack-elasticsearch#878

Original commit: elastic/x-pack-elasticsearch@921c25537a
2017-03-30 11:53:00 +01:00
Dimitris Athanasiou 12fd8e04e5 [ML] Allow marking a model snapshot with retain (elastic/x-pack-elasticsearch#880)
This change adds a retain field to model snapshots.
A user can set retain to true/false via the update model snapshot API.
Model snapshots with retain set to true will not be deleted by
the daily maintenance service regardless of whether they expired.

This allows users to keep always keep certain snapshots around for
potentially reverting to in the future.

relates elastic/x-pack-elasticsearch#758

Original commit: elastic/x-pack-elasticsearch@2283989a33
2017-03-30 11:48:36 +01:00
Dimitris Athanasiou 379b800c9f [ML] Handle usage call when MlMetadata is not yet installed (elastic/x-pack-elasticsearch#890)
Original commit: elastic/x-pack-elasticsearch@495286d4ba
2017-03-30 10:55:36 +01:00
David Roberts 72f5e92972 [ML] Adjust error to make sense for FAILED as well as CLOSED jobs (elastic/x-pack-elasticsearch#888)
Previously trying to perform an operation on a FAILED job would tell
you that it hadn't been opened.  This was very confusing if you knew
very well you'd just opened the job.

Relates elastic/x-pack-elasticsearch#879

Original commit: elastic/x-pack-elasticsearch@2dbe41caaa
2017-03-30 10:33:56 +01:00
David Roberts c335e79508 [TEST] Enable two blacklisted tests that now work
Previously force closing a job required extra privileges.  Following
the full discussion about what privileges should be required.

Original commit: elastic/x-pack-elasticsearch@4d85314b35
2017-03-30 10:26:15 +01:00
Martijn van Groningen 61b4f6480e [TEST] muted test
Original commit: elastic/x-pack-elasticsearch@550b55739e
2017-03-30 11:24:27 +02:00
Martijn van Groningen 9f63dba26c [ML] No need to create an InternalClient instance, because it can be injected.
Original commit: elastic/x-pack-elasticsearch@0cca0cd569
2017-03-30 09:11:46 +02:00
Martijn van Groningen f2654b5872 [ML] Changed job and datafeed lifecycle management
* Removed OPENING and CLOSING job states. Instead when persistent task has been created and
   status hasn't been set then this means we haven't yet started, when the executor changes it to STARTED we have.
   The coordinating node will monitor cs for a period of time until that happens and then returns or times out.
* Refactored job close api to go to node running job task and close job there.
* Changed unexpected job and datafeed exception messages to not mention the state and instead mention that job/datafeed haven't yet started/stopped.

Original commit: elastic/x-pack-elasticsearch@37e778b585
2017-03-29 20:35:10 +02:00
Chris Earle 905fa16f81 [Monitoring] Add .monitoring-alerts-2 Index Template (elastic/x-pack-elasticsearch#819)
Add the `.monitoring-alerts-2` index template via the exporter. This
avoids a very common problem where the user wipes out their monitoring
indices manually, which means that the watches would then create an index
with a dynamic mappings.

This adds a mechanism for posting a template that is not associated with a
Resolver (convenient for the forthcoming work _and_ for a future Logstash
index).

Original commit: elastic/x-pack-elasticsearch@a4cfc48191
2017-03-29 13:24:22 -04:00
Igor Motov 4bb9e00dbf Persistent Tasks: Remove unused stopped and removeOnCompletion flags (elastic/x-pack-elasticsearch#853)
The stopped and removeOnCompletion flags are not currently used, this commit removes them for now to simplify things.

Original commit: elastic/x-pack-elasticsearch@c636c2817e
2017-03-29 12:54:44 -04:00
Zachary Tong 0d202d3d36 Bump ChunkedDataExtractor logging down to DEBUG
Related elastic/x-pack-elasticsearch#866

Original commit: elastic/x-pack-elasticsearch@f510101be2
2017-03-29 12:16:36 -04:00
lcawley 8fc5aadec9 [DOCS] Add watcher rest-api docs to x-pack-elasticsearch
Original commit: elastic/x-pack-elasticsearch@a1cb375599
2017-03-29 09:07:55 -07:00
David Roberts 979d232faa [ML] Set jobs to FAILED state if C++ process dies unexpectedly (elastic/x-pack-elasticsearch#876)
Previously a `kill -9` on the `autodetect` process associated with a
job would leave the job in the OPENED state.

Now if the C++ process dies before a request to close the job is made
then the job state is set to FAILED.

For this purpose C++ process death is defined as end-of-file on the
log stream.  (Technically it would be possible to get end-of-file on
the log stream while the C++ process was still running, but this
would also represent an unexpected and undesirable situation.)

Original commit: elastic/x-pack-elasticsearch@2b74c56a79
2017-03-29 16:23:58 +01:00