diff options
8 files changed, 12 insertions, 87 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java b/config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java index 02bb0b412d1..cb3308d75bf 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java @@ -251,28 +251,6 @@ public abstract class AbstractService extends AbstractConfigProducer<AbstractCon } /** - * Tells if this service should be autostarted by - * config-sentinel. Returned value will be used to configure the - * config-sentinel. - * - * @return true by default. - */ - public boolean getAutostartFlag() { - return true; - } - - /** - * Tells if this service should be autorestarted by - * config-sentinel. Returned value will be used to configure the - * config-sentinel. - * - * @return true by default. - */ - public boolean getAutorestartFlag() { - return true; - } - - /** * Returns the name that identifies this service for the config-sentinel. * * @return the name that identifies this service for the config-sentinel. diff --git a/config-model/src/main/java/com/yahoo/vespa/model/ConfigProxy.java b/config-model/src/main/java/com/yahoo/vespa/model/ConfigProxy.java index 7ab28faa434..4fe13c8bede 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/ConfigProxy.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/ConfigProxy.java @@ -52,14 +52,4 @@ public class ConfigProxy extends AbstractService { return new String[]{"rpc"}; } - /** - * The config proxy is not started by the config system! - */ - public boolean getAutostartFlag() { return false; } - - /** - * The config proxy is not started by the config system! - */ - public boolean getAutorestartFlag() { return false; } - } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/ConfigSentinel.java b/config-model/src/main/java/com/yahoo/vespa/model/ConfigSentinel.java index 1b5c5e4a579..3f1202ccfd7 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/ConfigSentinel.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/ConfigSentinel.java @@ -87,8 +87,6 @@ public class ConfigSentinel extends AbstractService implements SentinelConfig.Pr SentinelConfig.Service.Builder serviceBuilder = new SentinelConfig.Service.Builder(); serviceBuilder.command(s.getStartupCommand()); serviceBuilder.name(s.getServiceName()); - serviceBuilder.autostart(s.getAutostartFlag()); - serviceBuilder.autorestart(s.getAutorestartFlag()); serviceBuilder.id(s.getConfigId()); serviceBuilder.affinity(getServiceAffinity(s)); setPreShutdownCommand(serviceBuilder, s); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/Service.java b/config-model/src/main/java/com/yahoo/vespa/model/Service.java index 0af4355764c..7958718af11 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/Service.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/Service.java @@ -30,20 +30,6 @@ public interface Service extends ConfigProducer, NetworkPortRequestor { Optional<String> getPreShutdownCommand(); /** - * Tells if this service should be autostarted by - * config-sentinel. Returned value will be used to configure the - * config-sentinel. - */ - boolean getAutostartFlag(); - - /** - * Tells if this service should be autorestarted by - * config-sentinel. Returned value will be used to configure the - * config-sentinel. - */ - boolean getAutorestartFlag(); - - /** * Returns a PortsMeta object, giving access to more information * about the different ports of this service. */ diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/Configserver.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/Configserver.java index 2645b6cd59d..e8ca03b277d 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/admin/Configserver.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/Configserver.java @@ -55,16 +55,6 @@ public class Configserver extends AbstractService { return new String[]{ "rpc", "http" }; } - /** - * The configserver is not started by the config system! - */ - public boolean getAutostartFlag() { return false; } - - /** - * The configserver is not started by the config system! - */ - public boolean getAutorestartFlag() { return false; } - private int getConfigServerRpcPort() { return getRelativePort(0); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesTest.java b/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesTest.java index d83e10864cf..c6c08df64f4 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesTest.java @@ -50,21 +50,20 @@ public class GenericServicesTest { SentinelConfig sentinel3 = model.getConfig(SentinelConfig.class, sentinelConfigId3); SentinelConfig sentinel4 = model.getConfig(SentinelConfig.class, sentinelConfigId4); - assertServiceExists(sentinel1, "myservice", "mycmd1.sh", "myservice/0", true, true); - assertServiceExists(sentinel2, "myservice", "mycmd1.sh", "myservice/1", true, true); - assertServiceExists(sentinel3, "myservice", "mycmd1.sh", "myservice/2", true, true); - assertServiceExists(sentinel3, "myservice2", "mycmd1.sh", "myservice/3", true, true); - assertServiceExists(sentinel3, "myotherservice", "/home/vespa/bin/mycmd2.sh --ytest $FOO_BAR", "myotherservice/0", true, true); - assertServiceExists(sentinel4, "myotherservice", "/home/vespa/bin/mycmd2.sh --ytest $FOO_BAR", "myotherservice/1", true, true); + assertServiceExists(sentinel1, "myservice", "mycmd1.sh", "myservice/0"); + assertServiceExists(sentinel2, "myservice", "mycmd1.sh", "myservice/1"); + assertServiceExists(sentinel3, "myservice", "mycmd1.sh", "myservice/2"); + assertServiceExists(sentinel3, "myservice2", "mycmd1.sh", "myservice/3"); + assertServiceExists(sentinel3, "myotherservice", "/home/vespa/bin/mycmd2.sh --ytest $FOO_BAR", "myotherservice/0"); + assertServiceExists(sentinel4, "myotherservice", "/home/vespa/bin/mycmd2.sh --ytest $FOO_BAR", "myotherservice/1"); } - private void assertServiceExists(SentinelConfig sentinel, String serviceName, String cmd, String configId, boolean autostart, boolean autorestart) { + private void assertServiceExists(SentinelConfig sentinel, String serviceName, String cmd, String configId) { boolean matches = false; Iterator<SentinelConfig.Service> it = sentinel.service().iterator(); while (!matches && it.hasNext()) { SentinelConfig.Service service = it.next(); - matches = service.autorestart() == autorestart && - service.autostart() == autostart && + matches = service.name().equals(serviceName) && service.id().equals(configId) && service.command().equals(cmd); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleService.java b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleService.java index a38916463c4..8a5bbe36a73 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleService.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleService.java @@ -46,9 +46,6 @@ public class SimpleService extends AbstractService implements com.yahoo.test.Sta // Make sure this service is listed in the sentinel config public String getStartupCommand() { return "sleep 0"; } - public boolean getAutostartFlag() { return false; } - public boolean getAutorestartFlag() { return false; } - @Override public HashMap<String,String> getDefaultMetricDimensions(){ HashMap<String, String> dimensions = new HashMap<>(); diff --git a/configd/src/apps/sentinel/service.cpp b/configd/src/apps/sentinel/service.cpp index ebf96d2ed53..20c2a6c9b00 100644 --- a/configd/src/apps/sentinel/service.cpp +++ b/configd/src/apps/sentinel/service.cpp @@ -49,14 +49,10 @@ Service::Service(const SentinelConfig::Service& service, const SentinelConfig::A _metrics(metrics) { LOG(debug, "%s: created", name().c_str()); - LOG(debug, "autostart: %s", _config->autostart ? "YES" : "NO"); - LOG(debug, " restart: %s", _config->autorestart ? "YES" : "NO"); LOG(debug, " command: %s", _config->command.c_str()); LOG(debug, " configid: %s", _config->id.c_str()); - if (_config->autostart) { - start(); - } + start(); } void @@ -67,14 +63,6 @@ Service::reconfigure(const SentinelConfig::Service& config) "take effect at next restart", name().c_str(), _config->command.c_str(), config.command.c_str()); } - if (config.autostart != _config->autostart) { - LOG(debug, "%s: reconfigured autostart %s", name().c_str(), - config.autostart ? "OFF -> ON" : "ON -> OFF"); - } - if (config.autorestart != _config->autorestart) { - LOG(debug, "%s: reconfigured autorestart %s", name().c_str(), - config.autorestart ? "OFF -> ON" : "ON -> OFF"); - } if (config.id != _config->id) { LOG(warning, "%s: reconfigured config id '%s' -> '%s' - signaling service restart", name().c_str(), _config->id.c_str(), config.id.c_str()); @@ -85,8 +73,7 @@ Service::reconfigure(const SentinelConfig::Service& config) _config = new SentinelConfig::Service(config); if (_isAutomatic - && ((_config->autostart && _state == READY) - || (_config->autorestart && _state == FINISHED))) + && ((_state == READY) || (_state == FINISHED))) { LOG(debug, "%s: Restarting due to new config", name().c_str()); start(); @@ -334,9 +321,9 @@ Service::youExited(int status) } else if (_state == KILLING) { setState(KILLED); } - if (_isAutomatic && _config->autorestart && !stop()) { + if (_isAutomatic && !stop()) { // ### Implement some rate limiting here maybe? - LOG(debug, "%s: Has autorestart flag, restarting.", name().c_str()); + LOG(debug, "%s: Restarting.", name().c_str()); setState(READY); _metrics.totalRestartsCounter++; _metrics.sentinel_restarts.add(); |