|
17 | 17 | import org.elasticsearch.common.Strings; |
18 | 18 | import org.elasticsearch.common.component.AbstractComponent; |
19 | 19 | import org.elasticsearch.common.component.LifecycleListener; |
20 | | -import org.elasticsearch.common.settings.Setting; |
21 | | -import org.elasticsearch.common.settings.Setting.Property; |
22 | 20 | import org.elasticsearch.common.settings.Settings; |
23 | 21 | import org.elasticsearch.gateway.GatewayService; |
24 | 22 | import org.elasticsearch.index.shard.ShardId; |
|
39 | 37 |
|
40 | 38 | public class WatcherLifeCycleService extends AbstractComponent implements ClusterStateListener { |
41 | 39 |
|
42 | | - // this option configures watcher not to start, unless the cluster state contains information to start watcher |
43 | | - // if you start with an empty cluster, you can delay starting watcher until you call the API manually |
44 | | - // if you start with a cluster containing data, this setting might have no effect, once you called the API yourself |
45 | | - // this is merely for testing, to make sure that watcher only starts when manually called |
46 | | - public static final Setting<Boolean> SETTING_REQUIRE_MANUAL_START = |
47 | | - Setting.boolSetting("xpack.watcher.require_manual_start", false, Property.NodeScope); |
48 | | - |
49 | 40 | private final AtomicReference<WatcherState> state = new AtomicReference<>(WatcherState.STARTED); |
50 | 41 | private final AtomicReference<List<ShardRouting>> previousShardRoutings = new AtomicReference<>(Collections.emptyList()); |
51 | | - private final boolean requireManualStart; |
52 | 42 | private volatile boolean shutDown = false; // indicates that the node has been shutdown and we should never start watcher after this. |
53 | 43 | private volatile WatcherService watcherService; |
54 | 44 |
|
55 | 45 | WatcherLifeCycleService(Settings settings, ClusterService clusterService, WatcherService watcherService) { |
56 | 46 | super(settings); |
57 | 47 | this.watcherService = watcherService; |
58 | | - this.requireManualStart = SETTING_REQUIRE_MANUAL_START.get(settings); |
59 | 48 | clusterService.addListener(this); |
60 | 49 | // Close if the indices service is being stopped, so we don't run into search failures (locally) that will |
61 | 50 | // happen because we're shutting down and an watch is scheduled. |
@@ -91,13 +80,6 @@ public void clusterChanged(ClusterChangedEvent event) { |
91 | 80 | return; |
92 | 81 | } |
93 | 82 |
|
94 | | - // if watcher should not be started immediately unless it is has been manually configured to do so |
95 | | - WatcherMetaData watcherMetaData = event.state().getMetaData().custom(WatcherMetaData.TYPE); |
96 | | - if (watcherMetaData == null && requireManualStart) { |
97 | | - clearAllocationIds(); |
98 | | - return; |
99 | | - } |
100 | | - |
101 | 83 | if (Strings.isNullOrEmpty(event.state().nodes().getMasterNodeId())) { |
102 | 84 | pauseExecution("no master node"); |
103 | 85 | return; |
|
0 commit comments