Skip to content

Commit be37dbc

Browse files
spinscalekcm
authored andcommitted
Watcher: Remove test-only setting (#34377)
In 54cb890 a setting for testing only was introduced, that delayed the start up of watcher. With the changes of how is watcher is started/stopped over time, this is not needed anymore.
1 parent 0796995 commit be37dbc

File tree

3 files changed

+0
-21
lines changed

3 files changed

+0
-21
lines changed

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ public List<Setting<?>> getSettings() {
476476
settings.add(Setting.simpleString("xpack.watcher.input.search.default_timeout", Setting.Property.NodeScope));
477477
settings.add(Setting.simpleString("xpack.watcher.transform.search.default_timeout", Setting.Property.NodeScope));
478478
settings.add(Setting.simpleString("xpack.watcher.execution.scroll.timeout", Setting.Property.NodeScope));
479-
settings.add(WatcherLifeCycleService.SETTING_REQUIRE_MANUAL_START);
480479

481480
// bulk processor configuration
482481
settings.add(SETTING_BULK_ACTIONS);

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherLifeCycleService.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import org.elasticsearch.common.Strings;
1818
import org.elasticsearch.common.component.AbstractComponent;
1919
import org.elasticsearch.common.component.LifecycleListener;
20-
import org.elasticsearch.common.settings.Setting;
21-
import org.elasticsearch.common.settings.Setting.Property;
2220
import org.elasticsearch.common.settings.Settings;
2321
import org.elasticsearch.gateway.GatewayService;
2422
import org.elasticsearch.index.shard.ShardId;
@@ -39,23 +37,14 @@
3937

4038
public class WatcherLifeCycleService extends AbstractComponent implements ClusterStateListener {
4139

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-
4940
private final AtomicReference<WatcherState> state = new AtomicReference<>(WatcherState.STARTED);
5041
private final AtomicReference<List<ShardRouting>> previousShardRoutings = new AtomicReference<>(Collections.emptyList());
51-
private final boolean requireManualStart;
5242
private volatile boolean shutDown = false; // indicates that the node has been shutdown and we should never start watcher after this.
5343
private volatile WatcherService watcherService;
5444

5545
WatcherLifeCycleService(Settings settings, ClusterService clusterService, WatcherService watcherService) {
5646
super(settings);
5747
this.watcherService = watcherService;
58-
this.requireManualStart = SETTING_REQUIRE_MANUAL_START.get(settings);
5948
clusterService.addListener(this);
6049
// Close if the indices service is being stopped, so we don't run into search failures (locally) that will
6150
// happen because we're shutting down and an watch is scheduled.
@@ -91,13 +80,6 @@ public void clusterChanged(ClusterChangedEvent event) {
9180
return;
9281
}
9382

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-
10183
if (Strings.isNullOrEmpty(event.state().nodes().getMasterNodeId())) {
10284
pauseExecution("no master node");
10385
return;

x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsResponse;
5050
import org.elasticsearch.xpack.core.watcher.watch.ClockMock;
5151
import org.elasticsearch.xpack.core.watcher.watch.Watch;
52-
import org.elasticsearch.xpack.watcher.WatcherLifeCycleService;
5352
import org.elasticsearch.xpack.watcher.history.HistoryStore;
5453
import org.elasticsearch.xpack.watcher.notification.email.Authentication;
5554
import org.elasticsearch.xpack.watcher.notification.email.Email;
@@ -111,7 +110,6 @@ protected Settings nodeSettings(int nodeOrdinal) {
111110
// watcher settings that should work despite randomization
112111
.put("xpack.watcher.execution.scroll.size", randomIntBetween(1, 100))
113112
.put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100))
114-
.put(WatcherLifeCycleService.SETTING_REQUIRE_MANUAL_START.getKey(), true)
115113
.build();
116114
}
117115

0 commit comments

Comments
 (0)