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.
This commit is contained in:
Alexander Reelsen 2018-10-16 09:07:27 +02:00 committed by GitHub
parent f7df8718b9
commit 2645574a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 21 deletions

View File

@ -476,7 +476,6 @@ public class Watcher extends Plugin implements ActionPlugin, ScriptPlugin, Reloa
settings.add(Setting.simpleString("xpack.watcher.input.search.default_timeout", Setting.Property.NodeScope));
settings.add(Setting.simpleString("xpack.watcher.transform.search.default_timeout", Setting.Property.NodeScope));
settings.add(Setting.simpleString("xpack.watcher.execution.scroll.timeout", Setting.Property.NodeScope));
settings.add(WatcherLifeCycleService.SETTING_REQUIRE_MANUAL_START);
// bulk processor configuration
settings.add(SETTING_BULK_ACTIONS);

View File

@ -17,8 +17,6 @@ import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.component.LifecycleListener;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.index.shard.ShardId;
@ -39,23 +37,14 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
public class WatcherLifeCycleService extends AbstractComponent implements ClusterStateListener {
// this option configures watcher not to start, unless the cluster state contains information to start watcher
// if you start with an empty cluster, you can delay starting watcher until you call the API manually
// if you start with a cluster containing data, this setting might have no effect, once you called the API yourself
// this is merely for testing, to make sure that watcher only starts when manually called
public static final Setting<Boolean> SETTING_REQUIRE_MANUAL_START =
Setting.boolSetting("xpack.watcher.require_manual_start", false, Property.NodeScope);
private final AtomicReference<WatcherState> state = new AtomicReference<>(WatcherState.STARTED);
private final AtomicReference<List<ShardRouting>> previousShardRoutings = new AtomicReference<>(Collections.emptyList());
private final boolean requireManualStart;
private volatile boolean shutDown = false; // indicates that the node has been shutdown and we should never start watcher after this.
private volatile WatcherService watcherService;
WatcherLifeCycleService(Settings settings, ClusterService clusterService, WatcherService watcherService) {
super(settings);
this.watcherService = watcherService;
this.requireManualStart = SETTING_REQUIRE_MANUAL_START.get(settings);
clusterService.addListener(this);
// Close if the indices service is being stopped, so we don't run into search failures (locally) that will
// happen because we're shutting down and an watch is scheduled.
@ -91,13 +80,6 @@ public class WatcherLifeCycleService extends AbstractComponent implements Cluste
return;
}
// if watcher should not be started immediately unless it is has been manually configured to do so
WatcherMetaData watcherMetaData = event.state().getMetaData().custom(WatcherMetaData.TYPE);
if (watcherMetaData == null && requireManualStart) {
clearAllocationIds();
return;
}
if (Strings.isNullOrEmpty(event.state().nodes().getMasterNodeId())) {
pauseExecution("no master node");
return;

View File

@ -49,7 +49,6 @@ import org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource;
import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsResponse;
import org.elasticsearch.xpack.core.watcher.watch.ClockMock;
import org.elasticsearch.xpack.core.watcher.watch.Watch;
import org.elasticsearch.xpack.watcher.WatcherLifeCycleService;
import org.elasticsearch.xpack.watcher.history.HistoryStore;
import org.elasticsearch.xpack.watcher.notification.email.Authentication;
import org.elasticsearch.xpack.watcher.notification.email.Email;
@ -111,7 +110,6 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
// watcher settings that should work despite randomization
.put("xpack.watcher.execution.scroll.size", randomIntBetween(1, 100))
.put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100))
.put(WatcherLifeCycleService.SETTING_REQUIRE_MANUAL_START.getKey(), true)
.build();
}