OpenSearch/plugin
Alexander Reelsen 1b6d9d430c Watcher: Load for watch for execution as late as possible (elastic/x-pack-elasticsearch#2151)
When a watch is executed currently, it gets passed an in-memory
watch object, that was loaded, before the execution started.

This means there is a window of time, where an old watch could still
be executing, then a watch gets loaded for execution, then the old watch
execution finishes and updates the watch status and thus reindexes the
watch.

Now the watch, that got loaded for execution, executes and tries to
store its watch status, but fails, because the version of the watch
has changed.

This commit changes the point in time where the watch is loaded. Now
this only happens, while a watch is in its protected execution block,
and thus we can be sure, that there is no other execution of the watch
happening.

This will primarily impact watches, that execute often, but their
runtime is longer than the configured interval between executions.

Side fix: Removed some duplicate testing method and moved into 
WatcherTestUtils, fixed a tests with a ton of if's with random booleans
into separate tests.

relates elastic/x-pack-elasticsearch#395

Original commit: elastic/x-pack-elasticsearch@bf393023d7
2017-08-21 10:43:41 +02:00
..
bin/x-pack Enable command extensions 2017-08-17 22:50:52 -04:00
bwc Allow to change bwc refspec in xpack (elastic/x-pack-elasticsearch#2311) 2017-08-21 09:59:45 +02:00
config/x-pack Rename core plugin and transport dirs 2017-02-10 11:02:42 -08:00
keys Rename core plugin and transport dirs 2017-02-10 11:02:42 -08:00
licenses Use shaded rest client dependencies 2017-07-24 12:56:17 -05:00
ml-cpp-snapshot [ML] Do not download the ml-cpp zip when building it locally (elastic/x-pack-elasticsearch#2262) 2017-08-15 16:31:23 +01:00
src Watcher: Load for watch for execution as late as possible (elastic/x-pack-elasticsearch#2151) 2017-08-21 10:43:41 +02:00
.gitignore Remove QueryParseContext (elastic/x-pack-elasticsearch#1895) 2017-07-03 17:31:18 +02:00
build.gradle Create security bootstrap checks early to access secure settings safely (elastic/x-pack-elasticsearch#2282) 2017-08-16 13:01:52 +02:00