OpenSearch/x-pack
Jay Modi 515b53d297
Fix race in SLM master/cluster state listeners (#59896)
This change fixes two possible race conditions in SLM related to
how local master changes and cluster state events are observed. When
implementing the `LocalNodeMasterListener` interface, it is only
recommended to execute on a separate threadpool if the operations are
heavy and would block the cluster state thread. SLM specified that the
listeners should run in the Snapshot thread pool, but the operations
in the listener were lightweight. This had the side effect of causing
master changes to be delayed if the Snapshot threads were all busy and
could also potentially cause the `onMaster` and `offMaster` calls to
race if both were queued and then executed concurrently. Additionally,
the `SnapshotLifecycleService` is also a `ClusterStateListener` and
there is currently no order of operations guarantee between
`LocalNodeMasterListeners` and `ClusterStateListeners` so this could
lead to incorrect behavior.

The resolution for these two issues is that the
SnapshotRetentionService now specifies the `SAME` executor for its
implementation of the `LocalNodeMasterListener` interface. The
`SnapshotLifecycleService` is no longer a `LocalNodeMasterListener` and
instead tracks local master changes in its `ClusterStateListner`.

Backport of #59801
2020-07-20 09:59:46 -06:00
..
dev-tools Build: Merge xpack checkstyle config into core (#33399) 2018-09-05 09:17:02 -04:00
docs [DOCS] Simplify index template snippets for data streams (#59533) (#59553) 2020-07-14 17:28:43 -04:00
license-tools Replace compile configuration usage with api (7.x backport) (#58721) 2020-06-30 15:57:41 +02:00
plugin Fix race in SLM master/cluster state listeners (#59896) 2020-07-20 09:59:46 -06:00
qa Enforce fail on deprecated gradle usage (7.x backport) (#59758) 2020-07-20 08:52:30 +02:00
snapshot-tool Enforce fail on deprecated gradle usage (7.x backport) (#59758) 2020-07-20 08:52:30 +02:00
test Replace compile configuration usage with api (7.x backport) (#58721) 2020-06-30 15:57:41 +02:00
transport-client Replace compile configuration usage with api (7.x backport) (#58721) 2020-06-30 15:57:41 +02:00
NOTICE.txt
README.md
build.gradle Include vendored code notices in distribution notice files (#57017) (#57569) 2020-06-04 10:34:24 -07:00

README.md

Elastic License Functionality

This directory tree contains files subject to the Elastic License. The files subject to the Elastic License are grouped in this directory to clearly separate them from files licensed under the Apache License 2.0.