From 020f0a4cd1748624793b885a3e73548a8d49768e Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Tue, 1 Dec 2020 19:32:30 +0100 Subject: Revert "Merge pull request #15577 from vespa-engine/revert-15575-bratseth/apply-on-restart-take-9" This reverts commit b9f054f862e6fc7bdbf41b9404605e2a8ad6b249, reversing changes made to 535b586bae36880259a792e2292f02b8495950fe. --- config/src/apps/vespa-get-config/getconfig.cpp | 2 +- .../config/subscription/ConfigSubscriber.java | 24 +++++++++++- .../subscription/impl/ConfigSubscription.java | 34 ++++++++++++----- .../impl/GenericJRTConfigSubscription.java | 14 ++++++- .../subscription/impl/JRTConfigSubscription.java | 3 +- .../subscription/impl/JarConfigSubscription.java | 2 +- .../config/subscription/impl/MockConnection.java | 2 +- .../subscription/impl/RawConfigSubscription.java | 2 +- .../java/com/yahoo/vespa/config/ConfigPayload.java | 2 +- .../yahoo/vespa/config/ConfigPayloadApplier.java | 1 + .../java/com/yahoo/vespa/config/GenericConfig.java | 2 + .../java/com/yahoo/vespa/config/RawConfig.java | 43 ++++++++++++---------- .../vespa/config/buildergen/ConfigDefinition.java | 4 +- .../vespa/config/protocol/ConfigResponse.java | 2 + .../config/protocol/JRTClientConfigRequest.java | 3 ++ .../config/protocol/JRTClientConfigRequestV3.java | 6 +++ .../config/protocol/JRTServerConfigRequest.java | 7 +++- .../config/protocol/JRTServerConfigRequestV3.java | 9 ++++- .../vespa/config/protocol/SlimeConfigResponse.java | 11 +++++- .../vespa/config/protocol/SlimeResponseData.java | 6 +++ .../subscription/impl/JRTConfigRequesterTest.java | 6 +-- .../java/com/yahoo/vespa/config/RawConfigTest.java | 26 ++++++------- .../vespa/config/protocol/ConfigResponseTest.java | 4 +- .../config/protocol/JRTConfigRequestV3Test.java | 16 ++++---- config/src/tests/configagent/configagent.cpp | 3 +- config/src/tests/frt/frt.cpp | 8 ++-- config/src/vespa/config/common/configstate.h | 9 +++-- config/src/vespa/config/frt/protocol.cpp | 1 + config/src/vespa/config/frt/protocol.h | 1 + .../src/vespa/config/frt/slimeconfigresponse.cpp | 5 ++- 30 files changed, 176 insertions(+), 82 deletions(-) (limited to 'config') diff --git a/config/src/apps/vespa-get-config/getconfig.cpp b/config/src/apps/vespa-get-config/getconfig.cpp index a5e400bd354..92966b934f1 100644 --- a/config/src/apps/vespa-get-config/getconfig.cpp +++ b/config/src/apps/vespa-get-config/getconfig.cpp @@ -220,7 +220,7 @@ GetConfig::Main() FRTConfigRequestFactory requestFactory(protocolVersion, traceLevel, vespaVersion, config::protocol::readProtocolCompressionType()); FRTConnection connection(spec, _server->supervisor(), TimingValues()); ConfigKey key(configId, defName, defNamespace, defMD5, defSchema); - ConfigState state(configMD5, generation, false); + ConfigState state(configMD5, generation, false, false); FRTConfigRequest::UP request = requestFactory.createConfigRequest(key, &connection, state, serverTimeout * 1000); _target->InvokeSync(request->getRequest(), clientTimeout); // seconds diff --git a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java index 6bfaa992eb1..ad131f8e0dd 100644 --- a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java +++ b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java @@ -33,6 +33,7 @@ import static java.util.stream.Collectors.toList; public class ConfigSubscriber implements AutoCloseable { private static final Logger log = Logger.getLogger(ConfigSubscriber.class.getName()); + private State state = State.OPEN; protected final List> subscriptionHandles = new CopyOnWriteArrayList<>(); private final ConfigSource source; @@ -45,6 +46,13 @@ public class ConfigSubscriber implements AutoCloseable { /** Whether the last generation received was due to a system-internal redeploy, not an application package change */ private boolean internalRedeploy = false; + /** + * Whether the last generation should only be applied on restart, not immediately. + * Once this is set it will not be unset, as no future generation should be applied + * once there is a generation which require restart. + */ + private boolean applyOnRestart = false; + /** * Reuse requesters for equal source sets, limit number if many subscriptions. */ @@ -235,12 +243,15 @@ public class ConfigSubscriber implements AutoCloseable { * @param timeoutInMillis timeout to wait in milliseconds * @param requireChange if set, at least one config have to change * @return true, if a new config generation has been found for all configs (additionally requires - * that at lest one of them has changed if requireChange is true), false otherwise + * that at lest one of them has changed if requireChange is true), and + * the config should be applied at this time, false otherwise */ private boolean acquireSnapshot(long timeoutInMillis, boolean requireChange) { + boolean applyOnRestartOnly; synchronized (monitor) { if (state == State.CLOSED) return false; state = State.FROZEN; + applyOnRestartOnly = applyOnRestart; } long started = System.currentTimeMillis(); long timeLeftMillis = timeoutInMillis; @@ -269,9 +280,18 @@ public class ConfigSubscriber implements AutoCloseable { allGenerationsChanged &= config.isGenerationChanged(); anyConfigChanged |= config.isConfigChanged(); internalRedeployOnly &= config.isInternalRedeploy(); + applyOnRestartOnly |= requireChange && config.applyOnRestart(); // only if this is reconfig timeLeftMillis = timeoutInMillis + started - System.currentTimeMillis(); } - reconfigDue = (anyConfigChanged || !requireChange) && allGenerationsChanged && allGenerationsTheSame; + reconfigDue = ((anyConfigChanged && !applyOnRestartOnly) || !requireChange) + && allGenerationsChanged && allGenerationsTheSame; + + if (requireChange && applyOnRestartOnly) { // if this is a reconfig, disable future reconfigs until restart + synchronized (monitor) { + applyOnRestart = applyOnRestartOnly; + } + } + if (!reconfigDue && timeLeftMillis > 0) { sleep(timeLeftMillis); } diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java b/config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java index 3bf6093e872..15f6395c417 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java @@ -40,21 +40,28 @@ public abstract class ConfigSubscription { private final T config; private final Long generation; private final boolean internalRedeploy; - - private ConfigState(boolean generationChanged, Long generation, boolean internalRedeploy, boolean configChanged, T config) { + private final boolean applyOnRestart; + + private ConfigState(boolean generationChanged, + Long generation, + boolean internalRedeploy, + boolean applyOnRestart, + boolean configChanged, + T config) { this.generationChanged = generationChanged; this.generation = generation; this.internalRedeploy = internalRedeploy; + this.applyOnRestart = applyOnRestart; this.configChanged = configChanged; this.config = config; } private ConfigState(Long generation, T config) { - this(false, generation, false, false, config); + this(false, generation, false, false, false, config); } private ConfigState() { - this(false, 0L, false, false, null); + this(false, 0L, false, false, false, null); } private ConfigState createUnchanged() { return new ConfigState<>(generation, config); } @@ -68,6 +75,8 @@ public abstract class ConfigSubscription { */ public boolean isInternalRedeploy() { return internalRedeploy; } + public boolean applyOnRestart() { return applyOnRestart; } + public T getConfig() { return config; } } @@ -181,29 +190,34 @@ public abstract class ConfigSubscription { return !prev.getGeneration().equals(requiredGen) || prev.isConfigChanged(); } - void setConfig(Long generation, boolean internalRedeploy, T config) { - this.config.set(new ConfigState<>(true, generation, internalRedeploy, true, config)); + void setConfig(Long generation, boolean internalRedeploy, boolean applyOnRestart, T config) { + this.config.set(new ConfigState<>(true, generation, internalRedeploy, applyOnRestart, true, config)); } /** Used by {@link FileConfigSubscription} and {@link ConfigSetSubscription} */ protected void setConfigIncGen(T config) { ConfigState prev = this.config.get(); - this.config.set(new ConfigState<>(true, prev.getGeneration() + 1, prev.isInternalRedeploy(), true, config)); + this.config.set(new ConfigState<>(true, prev.getGeneration() + 1, prev.isInternalRedeploy(), prev.applyOnRestart(), true, config)); } protected void setConfigIfChanged(T config) { ConfigState prev = this.config.get(); - this.config.set(new ConfigState<>(true, prev.getGeneration(), prev.isInternalRedeploy(), !config.equals(prev.getConfig()), config)); + this.config.set(new ConfigState<>(true, prev.getGeneration(), prev.isInternalRedeploy(), prev.applyOnRestart(), !config.equals(prev.getConfig()), config)); } void setGeneration(Long generation) { ConfigState prev = config.get(); - this.config.set(new ConfigState<>(true, generation, prev.isInternalRedeploy(), prev.isConfigChanged(), prev.getConfig())); + this.config.set(new ConfigState<>(true, generation, prev.isInternalRedeploy(), prev.applyOnRestart(), prev.isConfigChanged(), prev.getConfig())); } void setInternalRedeploy(boolean internalRedeploy) { ConfigState prev = config.get(); - this.config.set(new ConfigState<>(prev.isGenerationChanged(), prev.getGeneration(), internalRedeploy, prev.isConfigChanged(), prev.getConfig())); + this.config.set(new ConfigState<>(prev.isGenerationChanged(), prev.getGeneration(), internalRedeploy, prev.applyOnRestart(), prev.isConfigChanged(), prev.getConfig())); + } + + void setApplyOnRestart(boolean applyOnRestart) { + ConfigState prev = config.get(); + this.config.set(new ConfigState<>(prev.isGenerationChanged(), prev.getGeneration(), prev.isInternalRedeploy(), applyOnRestart, prev.isConfigChanged(), prev.getConfig())); } /** diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/GenericJRTConfigSubscription.java b/config/src/main/java/com/yahoo/config/subscription/impl/GenericJRTConfigSubscription.java index eec18b93e71..ba8fc8a5e19 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/GenericJRTConfigSubscription.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/GenericJRTConfigSubscription.java @@ -18,7 +18,6 @@ import static java.util.logging.Level.FINE; * Used by config proxy. * * @author Vegard Havdal - * */ public class GenericJRTConfigSubscription extends JRTConfigSubscription { @@ -33,7 +32,7 @@ public class GenericJRTConfigSubscription extends JRTConfigSubscription "in setNewConfig, config=" + this.getConfigState().getConfig()); } @@ -60,6 +59,17 @@ public class GenericJRTConfigSubscription extends JRTConfigSubscription configState = getConfigState(); + + if (configState.getConfig() != null) { + configState.getConfig().setApplyOnRestart(applyOnRestart); + } + } + public RawConfig getRawConfig() { return getConfigState().getConfig(); } diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java b/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java index 44f6d65ee65..e9d5d317995 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java @@ -94,6 +94,7 @@ public class JRTConfigSubscription extends ConfigSubsc log.log(FINE, () -> "Polled queue and found config " + jrtReq); if (jrtReq.hasUpdatedGeneration()) { setInternalRedeploy(jrtReq.responseIsInternalRedeploy()); + setApplyOnRestart(jrtReq.responseIsApplyOnRestart()); if (jrtReq.hasUpdatedConfig()) { setNewConfig(jrtReq); } else { @@ -111,7 +112,7 @@ public class JRTConfigSubscription extends ConfigSubsc } catch (IllegalArgumentException e) { badConfigE = e; } - setConfig(jrtReq.getNewGeneration(), jrtReq.responseIsInternalRedeploy(), configInstance); + setConfig(jrtReq.getNewGeneration(), jrtReq.responseIsInternalRedeploy(), jrtReq.responseIsApplyOnRestart(), configInstance); if (badConfigE != null) { throw new IllegalArgumentException("Bad config from jrt", badConfigE); } diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/JarConfigSubscription.java b/config/src/main/java/com/yahoo/config/subscription/impl/JarConfigSubscription.java index 05da9a72837..9fc5d9d3300 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/JarConfigSubscription.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/JarConfigSubscription.java @@ -63,7 +63,7 @@ public class JarConfigSubscription extends ConfigSubsc } catch (IOException e) { throw new ConfigurationRuntimeException(e); } - setConfig(0L, false, config); + setConfig(0L, false, false, config); try { jarFile.close(); } catch (IOException e) { diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/MockConnection.java b/config/src/main/java/com/yahoo/config/subscription/impl/MockConnection.java index 58eed7f9e78..3a284489109 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/MockConnection.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/MockConnection.java @@ -115,7 +115,7 @@ public class MockConnection implements ConnectionPool, com.yahoo.vespa.config.Co JRTServerConfigRequestV3 jrtReq = JRTServerConfigRequestV3.createFromRequest(request); Payload payload = Payload.from(ConfigPayload.empty()); long generation = 1; - jrtReq.addOkResponse(payload, generation, false, ConfigUtils.getMd5(payload.getData())); + jrtReq.addOkResponse(payload, generation, false, false, ConfigUtils.getMd5(payload.getData())); } } diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/RawConfigSubscription.java b/config/src/main/java/com/yahoo/config/subscription/impl/RawConfigSubscription.java index 68ff6bb0135..1ff0a058a93 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/RawConfigSubscription.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/RawConfigSubscription.java @@ -35,7 +35,7 @@ public class RawConfigSubscription extends ConfigSubsc if (payload == null) { payload = inputPayload; ConfigPayload configPayload = new CfgConfigPayloadBuilder().deserialize(Arrays.asList(payload.split("\n"))); - setConfig(0L, false, configPayload.toInstance(configClass, key.getConfigId())); + setConfig(0L, false, false, configPayload.toInstance(configClass, key.getConfigId())); return true; } try { diff --git a/config/src/main/java/com/yahoo/vespa/config/ConfigPayload.java b/config/src/main/java/com/yahoo/vespa/config/ConfigPayload.java index 2f3a4bd2172..8153179e49c 100644 --- a/config/src/main/java/com/yahoo/vespa/config/ConfigPayload.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConfigPayload.java @@ -17,7 +17,7 @@ import java.io.IOException; import java.io.OutputStream; /** - * A class that holds a representation of a config payload. + * A config payload. * * @author Ulf Lilleengen */ diff --git a/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java b/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java index b4df42c802e..d24f09bda12 100644 --- a/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java @@ -38,6 +38,7 @@ import static java.util.logging.Level.INFO; * @author Ulf Lilleengen, hmusum, Tony Vaagenes */ public class ConfigPayloadApplier { + private final static Logger log = Logger.getLogger(ConfigPayloadApplier.class.getPackage().getName()); private final ConfigInstance.Builder rootBuilder; diff --git a/config/src/main/java/com/yahoo/vespa/config/GenericConfig.java b/config/src/main/java/com/yahoo/vespa/config/GenericConfig.java index 2f351cc2bd4..123d7c22093 100644 --- a/config/src/main/java/com/yahoo/vespa/config/GenericConfig.java +++ b/config/src/main/java/com/yahoo/vespa/config/GenericConfig.java @@ -12,6 +12,7 @@ import com.yahoo.config.ConfigInstance; * @author Ulf Lilleengen */ public class GenericConfig { + public static class GenericConfigBuilder implements ConfigInstance.Builder { private final ConfigPayloadBuilder payloadBuilder; @@ -49,6 +50,7 @@ public class GenericConfig { public String getDefMd5() { return ""; } + } } diff --git a/config/src/main/java/com/yahoo/vespa/config/RawConfig.java b/config/src/main/java/com/yahoo/vespa/config/RawConfig.java index 96908f055f1..cf0f1243acf 100755 --- a/config/src/main/java/com/yahoo/vespa/config/RawConfig.java +++ b/config/src/main/java/com/yahoo/vespa/config/RawConfig.java @@ -32,6 +32,7 @@ public class RawConfig extends ConfigInstance { private final Optional vespaVersion; private long generation; private boolean internalRedeploy; + private boolean applyOnRestart; /** * Constructor for an empty config (not yet resolved). @@ -40,29 +41,32 @@ public class RawConfig extends ConfigInstance { * @param defMd5 The md5 sum of the .def-file. */ public RawConfig(ConfigKey key, String defMd5) { - this(key, defMd5, null, "", 0L, false, 0, Collections.emptyList(), Optional.empty()); + this(key, defMd5, null, "", 0L, false, false, 0, Collections.emptyList(), Optional.empty()); } public RawConfig(ConfigKey key, String defMd5, Payload payload, String configMd5, long generation, - boolean internalRedeploy, List defContent, Optional vespaVersion) { - this(key, defMd5, payload, configMd5, generation, internalRedeploy, 0, defContent, vespaVersion); + boolean internalRedeploy, boolean applyOnRestart, List defContent, + Optional vespaVersion) { + this(key, defMd5, payload, configMd5, generation, internalRedeploy, applyOnRestart, 0, defContent, vespaVersion); } /** Copy constructor */ public RawConfig(RawConfig rawConfig) { this(rawConfig.key, rawConfig.defMd5, rawConfig.payload, rawConfig.configMd5, - rawConfig.generation, rawConfig.internalRedeploy, rawConfig.errorCode, - rawConfig.defContent, rawConfig.getVespaVersion()); + rawConfig.generation, rawConfig.internalRedeploy, rawConfig.applyOnRestart, + rawConfig.errorCode, rawConfig.defContent, rawConfig.getVespaVersion()); } public RawConfig(ConfigKey key, String defMd5, Payload payload, String configMd5, long generation, - boolean internalRedeploy, int errorCode, List defContent, Optional vespaVersion) { + boolean internalRedeploy, boolean applyOnRestart, int errorCode, List defContent, + Optional vespaVersion) { this.key = key; this.defMd5 = ConfigUtils.getDefMd5FromRequest(defMd5, defContent); this.payload = payload; this.configMd5 = configMd5; this.generation = generation; this.internalRedeploy = internalRedeploy; + this.applyOnRestart = applyOnRestart; this.errorCode = errorCode; this.defContent = defContent; this.vespaVersion = vespaVersion; @@ -80,6 +84,7 @@ public class RawConfig extends ConfigInstance { req.getNewConfigMd5(), req.getNewGeneration(), req.responseIsInternalRedeploy(), + req.responseIsApplyOnRestart(), 0, req.getDefContent().asList(), req.getVespaVersion()); @@ -97,6 +102,7 @@ public class RawConfig extends ConfigInstance { req.getRequestConfigMd5(), req.getRequestGeneration(), req.isInternalRedeploy(), + req.applyOnRestart(), 0, req.getDefContent().asList(), req.getVespaVersion()); @@ -121,12 +127,16 @@ public class RawConfig extends ConfigInstance { public void setInternalRedeploy(boolean internalRedeploy) { this.internalRedeploy = internalRedeploy; } + public void setApplyOnRestart(boolean applyOnRestart) { this.applyOnRestart = applyOnRestart; } + /** * Returns whether this config generation was created by a system internal redeploy, not an * application package change. */ public boolean isInternalRedeploy() { return internalRedeploy; } + public boolean applyOnRestart() { return applyOnRestart; } + public Payload getPayload() { return payload; } public int errorCode() { return errorCode; } @@ -165,24 +175,17 @@ public class RawConfig extends ConfigInstance { @Override public boolean equals(Object o) { - if (o == this) { - return true; - } - if (! (o instanceof RawConfig)) { - return false; - } + if (o == this) return true; + if (! (o instanceof RawConfig)) return false; + RawConfig other = (RawConfig) o; - if (! (key.equals(other.key) && - defMd5.equals(other.defMd5) && - (errorCode == other.errorCode)) ) { + if (! (key.equals(other.key) && defMd5.equals(other.defMd5) && (errorCode == other.errorCode)) ) return false; - } + // Need to check error codes before isError, since unequal error codes always means unequal requests, // while non-zero and equal error codes means configs are equal. - if (isError()) - return true; - if (generation != other.generation) - return false; + if (isError()) return true; + if (generation != other.generation) return false; if (configMd5 != null) { return configMd5.equals(other.configMd5); } else { diff --git a/config/src/main/java/com/yahoo/vespa/config/buildergen/ConfigDefinition.java b/config/src/main/java/com/yahoo/vespa/config/buildergen/ConfigDefinition.java index e145f8ee090..3fe42ce90ad 100644 --- a/config/src/main/java/com/yahoo/vespa/config/buildergen/ConfigDefinition.java +++ b/config/src/main/java/com/yahoo/vespa/config/buildergen/ConfigDefinition.java @@ -1,13 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.buildergen; -import com.google.common.io.Files; import com.yahoo.config.codegen.DefParser; import com.yahoo.config.codegen.InnerCNode; -import com.yahoo.config.codegen.JavaClassBuilder; import com.yahoo.text.StringUtilities; -import java.io.File; import java.io.StringReader; /** @@ -15,6 +12,7 @@ import java.io.StringReader; * @author Ulf Lilleengen */ public class ConfigDefinition { + private final String name; private final String[] defSchema; private final InnerCNode cnode; diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/ConfigResponse.java b/config/src/main/java/com/yahoo/vespa/config/protocol/ConfigResponse.java index bb0ee2bb935..27f4816849d 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/ConfigResponse.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/ConfigResponse.java @@ -22,6 +22,8 @@ public interface ConfigResponse { boolean isInternalRedeploy(); + boolean applyOnRestart(); + String getConfigMd5(); void serialize(OutputStream os, CompressionType uncompressed) throws IOException; diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTClientConfigRequest.java b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTClientConfigRequest.java index ab47fec0641..8f85e2353a5 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTClientConfigRequest.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTClientConfigRequest.java @@ -56,6 +56,9 @@ public interface JRTClientConfigRequest extends JRTConfigRequest { /** Returns whether this config change is due to an internal change not an application package change */ boolean responseIsInternalRedeploy(); + /** Returns true if this config should only be applied at the last restart, false if it should be applied immediately */ + boolean responseIsApplyOnRestart(); + /** * Get the config md5 of the config returned by the server. Return an empty string if no response has been returned. * diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTClientConfigRequestV3.java b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTClientConfigRequestV3.java index 12e5968ab83..e04a2179602 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTClientConfigRequestV3.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTClientConfigRequestV3.java @@ -181,6 +181,7 @@ public class JRTClientConfigRequestV3 implements JRTClientConfigRequest { sb.append("response='").append(getNewConfigMd5()) .append(",").append(getNewGeneration()) .append(",").append(responseIsInternalRedeploy()) + .append(",").append(responseIsApplyOnRestart()) .append("'\n"); return sb.toString(); } @@ -294,6 +295,11 @@ public class JRTClientConfigRequestV3 implements JRTClientConfigRequest { return responseData.getResponseInternalRedeployment(); } + @Override + public boolean responseIsApplyOnRestart() { + return responseData.getResponseApplyOnRestart(); + } + @Override public long getRequestGeneration() { return requestData.getRequestGeneration(); diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequest.java b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequest.java index 763f672a513..dbc6a7bb98d 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequest.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequest.java @@ -34,9 +34,12 @@ public interface JRTServerConfigRequest extends JRTConfigRequest, GetConfigReque * @param generation The config generation of the given payload. * @param internalRedeployment whether this payload was generated from an internal redeployment not an * application package change + * @param applyOnRestart true if this config should only be applied on the next restart, + * false if it should be applied right away * @param configMd5 The md5sum of the given payload. */ - void addOkResponse(Payload payload, long generation, boolean internalRedeployment, String configMd5); + void addOkResponse(Payload payload, long generation, boolean internalRedeployment, boolean applyOnRestart, + String configMd5); /** * Get the current config md5 of the client config. @@ -65,6 +68,8 @@ public interface JRTServerConfigRequest extends JRTConfigRequest, GetConfigReque */ boolean isInternalRedeploy(); + boolean applyOnRestart(); + /** * Get the request trace for this request. The trace can be used to trace config execution to provide useful * debug info in production environments. diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java index 3609ba04424..0bc7c44fe9d 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTServerConfigRequestV3.java @@ -37,6 +37,7 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { private final SlimeRequestData requestData; /** Response field */ private boolean internalRedeploy = false; + private boolean applyOnRestart = false; // Response values private boolean isDelayed = false; private Trace requestTrace = null; @@ -67,8 +68,10 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { } @Override - public void addOkResponse(Payload payload, long generation, boolean internalRedeploy, String configMd5) { + public void addOkResponse(Payload payload, long generation, boolean internalRedeploy, boolean applyOnRestart, + String configMd5) { this.internalRedeploy = internalRedeploy; + this.applyOnRestart = applyOnRestart; boolean changedConfig = !configMd5.equals(getRequestConfigMd5()); boolean changedConfigAndNewGeneration = changedConfig && ConfigUtils.isGenerationNewer(generation, getRequestGeneration()); Payload responsePayload = payload.withCompression(getCompressionType()); @@ -80,6 +83,7 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { setResponseField(jsonGenerator, SlimeResponseData.RESPONSE_CONFIG_MD5, configMd5); setResponseField(jsonGenerator, SlimeResponseData.RESPONSE_CONFIG_GENERATION, generation); setResponseField(jsonGenerator, SlimeResponseData.RESPONSE_INTERNAL_REDEPLOY, internalRedeploy); + setResponseField(jsonGenerator, SlimeResponseData.RESPONSE_APPLY_ON_RESTART, applyOnRestart); jsonGenerator.writeObjectFieldStart(SlimeResponseData.RESPONSE_COMPRESSION_INFO); if (responsePayload == null) { throw new RuntimeException("Payload is null for ' " + this + ", not able to create response"); @@ -113,6 +117,9 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { @Override public boolean isInternalRedeploy() { return internalRedeploy; } + @Override + public boolean applyOnRestart() { return applyOnRestart; } + public static JRTServerConfigRequestV3 createFromRequest(Request req) { return new JRTServerConfigRequestV3(req); } diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeConfigResponse.java b/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeConfigResponse.java index ff0b7f964bf..8bdd336fd5c 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeConfigResponse.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeConfigResponse.java @@ -18,12 +18,14 @@ public class SlimeConfigResponse implements ConfigResponse { private final CompressionInfo compressionInfo; private final long generation; private final boolean internalRedeploy; + private final boolean applyOnRestart; private final String configMd5; public static SlimeConfigResponse fromConfigPayload(ConfigPayload payload, long generation, - boolean internalRedeploy, String configMd5) { + boolean internalRedeploy, boolean applyOnRestart, + String configMd5) { Utf8Array data = payload.toUtf8Array(true); - return new SlimeConfigResponse(data, generation, internalRedeploy, + return new SlimeConfigResponse(data, generation, internalRedeploy, applyOnRestart, configMd5, CompressionInfo.create(CompressionType.UNCOMPRESSED, data.getByteLength())); } @@ -31,11 +33,13 @@ public class SlimeConfigResponse implements ConfigResponse { public SlimeConfigResponse(Utf8Array payload, long generation, boolean internalRedeploy, + boolean applyOnRestart, String configMd5, CompressionInfo compressionInfo) { this.payload = payload; this.generation = generation; this.internalRedeploy = internalRedeploy; + this.applyOnRestart = applyOnRestart; this.configMd5 = configMd5; this.compressionInfo = compressionInfo; } @@ -57,6 +61,9 @@ public class SlimeConfigResponse implements ConfigResponse { @Override public boolean isInternalRedeploy() { return internalRedeploy; } + @Override + public boolean applyOnRestart() { return applyOnRestart; } + @Override public String getConfigMd5() { return configMd5; diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeResponseData.java b/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeResponseData.java index ba1e7a8c72e..1c9afa550d4 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeResponseData.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeResponseData.java @@ -24,6 +24,7 @@ class SlimeResponseData { static final String RESPONSE_CONFIG_MD5 = "configMD5"; static final String RESPONSE_CONFIG_GENERATION = "generation"; static final String RESPONSE_INTERNAL_REDEPLOY = "internalRedeploy"; + static final String RESPONSE_APPLY_ON_RESTART = "applyOnRestart"; static final String RESPONSE_COMPRESSION_INFO = "compressionInfo"; private final Request request; @@ -72,4 +73,9 @@ class SlimeResponseData { return inspector.valid() && inspector.asBool(); } + boolean getResponseApplyOnRestart() { + Inspector inspector = getResponseField(RESPONSE_APPLY_ON_RESTART); + return inspector.valid() && inspector.asBool(); + } + } diff --git a/config/src/test/java/com/yahoo/config/subscription/impl/JRTConfigRequesterTest.java b/config/src/test/java/com/yahoo/config/subscription/impl/JRTConfigRequesterTest.java index 4211345dff7..07ff27a0154 100644 --- a/config/src/test/java/com/yahoo/config/subscription/impl/JRTConfigRequesterTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/impl/JRTConfigRequesterTest.java @@ -184,7 +184,7 @@ public class JRTConfigRequesterTest { ConfigSubscriber subscriber = new ConfigSubscriber(); final TimingValues timingValues = getTestTimingValues(); JRTConfigSubscription sub = createSubscription(subscriber, timingValues); - sub.setConfig(1L, false, config()); + sub.setConfig(1L, false, false, config()); final MockConnection connection = new MockConnection(new ErrorResponseHandler()); JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues); @@ -212,7 +212,7 @@ public class JRTConfigRequesterTest { ConfigSubscriber subscriber = new ConfigSubscriber(); final TimingValues timingValues = getTestTimingValues(); JRTConfigSubscription sub = createSubscription(subscriber, timingValues); - sub.setConfig(1L, false, config()); + sub.setConfig(1L, false, false, config()); final MockConnection connection = new MockConnection(new ErrorResponseHandler(com.yahoo.jrt.ErrorCode.TIMEOUT)); JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues); @@ -227,7 +227,7 @@ public class JRTConfigRequesterTest { ConfigSubscriber subscriber = new ConfigSubscriber(); final TimingValues timingValues = getTestTimingValues(); JRTConfigSubscription sub = createSubscription(subscriber, timingValues); - sub.setConfig(1L, false, config()); + sub.setConfig(1L, false, false, config()); final MockConnection connection = new MockConnection(new ErrorResponseHandler(ErrorCode.UNKNOWN_DEFINITION)); JRTConfigRequester requester = new JRTConfigRequester(connection, timingValues); diff --git a/config/src/test/java/com/yahoo/vespa/config/RawConfigTest.java b/config/src/test/java/com/yahoo/vespa/config/RawConfigTest.java index 3f6c54ea46e..9fd0b9ba1fa 100644 --- a/config/src/test/java/com/yahoo/vespa/config/RawConfigTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/RawConfigTest.java @@ -61,14 +61,14 @@ public class RawConfigTest { assertThat(config.hashCode(), is(not(new RawConfig(key, "a").hashCode()))); // different def md5 // different generation - config = new RawConfig(key, defMd5, payload, configMd5, generation, false, defContent, Optional.empty()); - RawConfig config2 = new RawConfig(key, defMd5, payload, configMd5, 2L, false, defContent, Optional.empty()); + config = new RawConfig(key, defMd5, payload, configMd5, generation, false, false, defContent, Optional.empty()); + RawConfig config2 = new RawConfig(key, defMd5, payload, configMd5, 2L, false, false, defContent, Optional.empty()); assertThat(config, is(not(config2))); assertThat(config.hashCode(), is(not(config2.hashCode()))); // different config md5 and with vespa version final VespaVersion vespaVersion = VespaVersion.fromString("5.37.38"); - RawConfig config3 = new RawConfig(key, defMd5, payload, "9999", generation, false, defContent, Optional.of(vespaVersion)); + RawConfig config3 = new RawConfig(key, defMd5, payload, "9999", generation, false, false, defContent, Optional.of(vespaVersion)); assertThat(config, is(not(config3))); assertThat(config.hashCode(), is(not(config3.hashCode()))); // Check that vespa version is set correctly @@ -82,19 +82,19 @@ public class RawConfigTest { assertNotEquals(config, key); // errors - RawConfig errorConfig1 = new RawConfig(key, defMd5, payload, configMd5, generation, false, 1, defContent, Optional.empty()); + RawConfig errorConfig1 = new RawConfig(key, defMd5, payload, configMd5, generation, false, false, 1, defContent, Optional.empty()); assertThat(errorConfig1, is(errorConfig1)); assertThat(config, is(not(errorConfig1))); assertThat(config.hashCode(), is(not(errorConfig1.hashCode()))); assertThat(errorConfig1, is(errorConfig1)); - RawConfig errorConfig2 = new RawConfig(key, defMd5, payload, configMd5, generation, false, 2, defContent, Optional.empty()); + RawConfig errorConfig2 = new RawConfig(key, defMd5, payload, configMd5, generation, false, false, 2, defContent, Optional.empty()); assertThat(errorConfig1, is(not(errorConfig2))); assertThat(errorConfig1.hashCode(), is(not(errorConfig2.hashCode()))); } @Test public void payload() { - RawConfig config = new RawConfig(key, defMd5, payload, configMd5, generation, false, defContent, Optional.empty()); + RawConfig config = new RawConfig(key, defMd5, payload, configMd5, generation, false, false, defContent, Optional.empty()); assertThat(config.getPayload(), is(payload)); assertThat(config.getConfigMd5(), is(configMd5)); assertThat(config.getGeneration(), is(generation)); @@ -105,19 +105,19 @@ public class RawConfigTest { public void require_correct_defmd5() { final String defMd5ForEmptyDefContent = "d41d8cd98f00b204e9800998ecf8427e"; - RawConfig config = new RawConfig(key, null, payload, configMd5, generation, false, defContent, Optional.empty()); + RawConfig config = new RawConfig(key, null, payload, configMd5, generation, false, false, defContent, Optional.empty()); assertThat(config.getDefMd5(), is(defMd5)); - config = new RawConfig(key, "", payload, configMd5, generation, false, defContent, Optional.empty()); + config = new RawConfig(key, "", payload, configMd5, generation, false, false, defContent, Optional.empty()); assertThat(config.getDefMd5(), is(defMd5)); - config = new RawConfig(key, defMd5, payload, configMd5, generation, false, defContent, Optional.empty()); + config = new RawConfig(key, defMd5, payload, configMd5, generation, false, false, defContent, Optional.empty()); assertThat(config.getDefMd5(), is(defMd5)); - config = new RawConfig(key, null, payload, configMd5, generation, false, null, Optional.empty()); + config = new RawConfig(key, null, payload, configMd5, generation, false, false, null, Optional.empty()); assertNull(config.getDefMd5()); - config = new RawConfig(key, null, payload, configMd5, generation, false,List.of(""), Optional.empty()); + config = new RawConfig(key, null, payload, configMd5, generation, false,false, List.of(""), Optional.empty()); assertThat(config.getDefMd5(), is(defMd5ForEmptyDefContent)); - config = new RawConfig(key, "", payload, configMd5, generation, false, null, Optional.empty()); + config = new RawConfig(key, "", payload, configMd5, generation, false, false, null, Optional.empty()); assertThat(config.getDefMd5(), is("")); - config = new RawConfig(key, "", payload, configMd5, generation, false, List.of(""), Optional.empty()); + config = new RawConfig(key, "", payload, configMd5, generation, false, false, List.of(""), Optional.empty()); assertThat(config.getDefMd5(), is(defMd5ForEmptyDefContent)); } diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java b/config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java index a56c7ef2daa..98eda868bbf 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java @@ -24,7 +24,7 @@ public class ConfigResponseTest { @Test public void require_that_slime_response_is_initialized() throws IOException { ConfigPayload configPayload = ConfigPayload.fromInstance(new SimpletypesConfig(new SimpletypesConfig.Builder())); - ConfigResponse response = SlimeConfigResponse.fromConfigPayload(configPayload, 3, false, "mymd5"); + ConfigResponse response = SlimeConfigResponse.fromConfigPayload(configPayload, 3, false, false, "mymd5"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); response.serialize(baos, CompressionType.UNCOMPRESSED); String payload = baos.toString(StandardCharsets.UTF_8); @@ -43,7 +43,7 @@ public class ConfigResponseTest { ConfigPayload configPayload = ConfigPayload.fromInstance(new SimpletypesConfig(new SimpletypesConfig.Builder())); Utf8Array data = configPayload.toUtf8Array(true); Utf8Array bytes = new Utf8Array(new LZ4PayloadCompressor().compress(data.getBytes())); - ConfigResponse response = new SlimeConfigResponse(bytes, 3, false, "mymd5", CompressionInfo.create(CompressionType.LZ4, data.getByteLength())); + ConfigResponse response = new SlimeConfigResponse(bytes, 3, false, false, "mymd5", CompressionInfo.create(CompressionType.LZ4, data.getByteLength())); ByteArrayOutputStream baos = new ByteArrayOutputStream(); response.serialize(baos, CompressionType.UNCOMPRESSED); String payload = baos.toString(StandardCharsets.UTF_8); diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestV3Test.java b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestV3Test.java index d4f8b771880..6fc55e60a54 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestV3Test.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestV3Test.java @@ -73,8 +73,8 @@ public class JRTConfigRequestV3Test { @Test public void emptypayload() { ConfigPayload payload = ConfigPayload.empty(); - SlimeConfigResponse response = SlimeConfigResponse.fromConfigPayload(payload, 0, false, ConfigUtils.getMd5(payload)); - serverReq.addOkResponse(serverReq.payloadFromResponse(response), response.getGeneration(), false, response.getConfigMd5()); + SlimeConfigResponse response = SlimeConfigResponse.fromConfigPayload(payload, 0, false, false, ConfigUtils.getMd5(payload)); + serverReq.addOkResponse(serverReq.payloadFromResponse(response), response.getGeneration(), false, false, response.getConfigMd5()); assertTrue(clientReq.validateResponse()); assertTrue(clientReq.hasUpdatedGeneration()); assertThat(clientReq.getNewPayload().withCompression(CompressionType.UNCOMPRESSED).getData().toString(), is("{}")); @@ -92,7 +92,7 @@ public class JRTConfigRequestV3Test { @Test public void next_request_when_error_is_correct() { - serverReq.addOkResponse(createPayload(), 999999, false, "newmd5"); + serverReq.addOkResponse(createPayload(), 999999, false, false, "newmd5"); serverReq.addErrorResponse(ErrorCode.OUTDATED_CONFIG, "error message"); System.out.println(serverReq); JRTClientConfigRequest next = clientReq.nextRequest(6); @@ -108,7 +108,7 @@ public class JRTConfigRequestV3Test { Payload payload = createPayload("vale"); String md5 = ConfigUtils.getMd5(payload.getData()); long generation = 4L; - serverReq.addOkResponse(payload, generation, false, md5); + serverReq.addOkResponse(payload, generation, false, false, md5); assertTrue(clientReq.validateResponse()); assertThat(clientReq.getNewPayload().withCompression(CompressionType.UNCOMPRESSED).getData().toString(), is(payload.getData().toString())); assertThat(clientReq.getNewGeneration(), is(4L)); @@ -134,7 +134,7 @@ public class JRTConfigRequestV3Test { @Test public void generation_only_is_updated() { Payload payload = createPayload(); - serverReq.addOkResponse(payload, 4L, false, ConfigUtils.getMd5(payload.getData())); + serverReq.addOkResponse(payload, 4L, false, false, ConfigUtils.getMd5(payload.getData())); boolean value = clientReq.validateResponse(); assertTrue(clientReq.errorMessage(), value); assertFalse(clientReq.hasUpdatedConfig()); @@ -144,7 +144,7 @@ public class JRTConfigRequestV3Test { @Test public void nothing_is_updated() { Payload payload = createPayload(); - serverReq.addOkResponse(payload, currentGeneration, false, configMd5); + serverReq.addOkResponse(payload, currentGeneration, false, false, configMd5); assertTrue(clientReq.validateResponse()); assertFalse(clientReq.hasUpdatedConfig()); assertFalse(clientReq.hasUpdatedGeneration()); @@ -155,7 +155,7 @@ public class JRTConfigRequestV3Test { Payload payload = Payload.from(ConfigPayload.empty()); clientReq = createReq(payload); serverReq = createReq(clientReq.getRequest()); - serverReq.addOkResponse(payload, currentGeneration, false, ConfigUtils.getMd5(payload.getData())); + serverReq.addOkResponse(payload, currentGeneration, false, false, ConfigUtils.getMd5(payload.getData())); boolean val = clientReq.validateResponse(); assertTrue(clientReq.errorMessage(), val); assertFalse(clientReq.hasUpdatedConfig()); @@ -192,7 +192,7 @@ public class JRTConfigRequestV3Test { @Override public void createResponse() { JRTServerConfigRequest serverRequest = createReq(request); - serverRequest.addOkResponse(createPayload(), currentGeneration, false, configMd5); + serverRequest.addOkResponse(createPayload(), currentGeneration, false, false, configMd5); } }); diff --git a/config/src/tests/configagent/configagent.cpp b/config/src/tests/configagent/configagent.cpp index a7cc95ab883..7cc0abee0bc 100644 --- a/config/src/tests/configagent/configagent.cpp +++ b/config/src/tests/configagent/configagent.cpp @@ -36,7 +36,7 @@ public: _value(value), _fillCalled(false), _valid(valid), - _state(md5, timestamp, false), + _state(md5, timestamp, false, false), _errorMessage(errorMsg), _errorCode(errorC0de), _isError(iserror) @@ -142,6 +142,7 @@ TEST("require that agent returns correct values") { ASSERT_EQUAL(cs.md5, handler.getConfigState().md5); ASSERT_EQUAL(cs.generation, handler.getConfigState().generation); ASSERT_EQUAL(cs.internalRedeploy, handler.getConfigState().internalRedeploy); + ASSERT_EQUAL(cs.applyOnRestart, handler.getConfigState().applyOnRestart); } TEST("require that successful request is delivered to holder") { diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp index 0d70605fa62..60973aea2bf 100644 --- a/config/src/tests/frt/frt.cpp +++ b/config/src/tests/frt/frt.cpp @@ -276,10 +276,10 @@ TEST("require that v3 request is correctly initialized") { traceIn.trace(2, "Hei"); FRTConfigRequestV3 v3req(&conn, key, md5, currentGeneration, hostName, timeout, traceIn, VespaVersion::fromString("1.2.3"), CompressionType::LZ4); - ASSERT_TRUE(v3req.verifyState(ConfigState(md5, 3, false))); - ASSERT_FALSE(v3req.verifyState(ConfigState(md5, 2, false))); - ASSERT_FALSE(v3req.verifyState(ConfigState("xxx", 3, false))); - ASSERT_FALSE(v3req.verifyState(ConfigState("xxx", 2, false))); + ASSERT_TRUE(v3req.verifyState(ConfigState(md5, 3, false, false))); + ASSERT_FALSE(v3req.verifyState(ConfigState(md5, 2, false, false))); + ASSERT_FALSE(v3req.verifyState(ConfigState("xxx", 3, false, false))); + ASSERT_FALSE(v3req.verifyState(ConfigState("xxx", 2, false, false))); ConfigDefinition origDef(MyConfig::CONFIG_DEF_SCHEMA); diff --git a/config/src/vespa/config/common/configstate.h b/config/src/vespa/config/common/configstate.h index fe415f038e3..155c182271b 100644 --- a/config/src/vespa/config/common/configstate.h +++ b/config/src/vespa/config/common/configstate.h @@ -15,17 +15,20 @@ public: ConfigState() : md5(""), generation(0), - internalRedeploy(false) + internalRedeploy(false), + applyOnRestart(false) { } - ConfigState(const vespalib::string & md5sum, int64_t gen, bool value) + ConfigState(const vespalib::string & md5sum, int64_t gen, bool _internalRedeploy, bool _applyOnRestart) : md5(md5sum), generation(gen), - internalRedeploy(value) + internalRedeploy(_internalRedeploy), + applyOnRestart(_applyOnRestart) { } vespalib::string md5; int64_t generation; bool internalRedeploy; + bool applyOnRestart; bool isNewerGenerationThan(const ConfigState & other) const { return isGenerationNewer(generation, other.generation); diff --git a/config/src/vespa/config/frt/protocol.cpp b/config/src/vespa/config/frt/protocol.cpp index cfd248e5d86..5019cce23c5 100644 --- a/config/src/vespa/config/frt/protocol.cpp +++ b/config/src/vespa/config/frt/protocol.cpp @@ -41,6 +41,7 @@ const Memory RESPONSE_CONFIG_GENERATION = "generation"; const Memory RESPONSE_PAYLOAD = "payload"; const Memory RESPONSE_TRACE = "trace"; const Memory RESPONSE_INTERNAL_REDEPLOY = "internalRedeploy"; +const Memory RESPONSE_APPLY_ON_RESTART = "applyOnRestart"; const Inspector & extractPayload(const Slime & data) diff --git a/config/src/vespa/config/frt/protocol.h b/config/src/vespa/config/frt/protocol.h index a14fa492ac7..a7465ef979d 100644 --- a/config/src/vespa/config/frt/protocol.h +++ b/config/src/vespa/config/frt/protocol.h @@ -53,6 +53,7 @@ extern const vespalib::Memory RESPONSE_CONFIG_GENERATION; extern const vespalib::Memory RESPONSE_PAYLOAD; extern const vespalib::Memory RESPONSE_TRACE; extern const vespalib::Memory RESPONSE_INTERNAL_REDEPLOY; +extern const vespalib::Memory RESPONSE_APPLY_ON_RESTART; const vespalib::slime::Inspector & extractPayload(const vespalib::Slime & data); diff --git a/config/src/vespa/config/frt/slimeconfigresponse.cpp b/config/src/vespa/config/frt/slimeconfigresponse.cpp index 155515d2ed6..f778fe574f1 100644 --- a/config/src/vespa/config/frt/slimeconfigresponse.cpp +++ b/config/src/vespa/config/frt/slimeconfigresponse.cpp @@ -66,7 +66,10 @@ ConfigState SlimeConfigResponse::readState() const { const Slime & data(*_data); - return ConfigState(data.get()[RESPONSE_CONFIG_MD5].asString().make_string(), data.get()[RESPONSE_CONFIG_GENERATION].asLong(), data.get()[RESPONSE_INTERNAL_REDEPLOY].asBool()); + return ConfigState(data.get()[RESPONSE_CONFIG_MD5].asString().make_string(), + data.get()[RESPONSE_CONFIG_GENERATION].asLong(), + data.get()[RESPONSE_INTERNAL_REDEPLOY].asBool(), + data.get()[RESPONSE_APPLY_ON_RESTART].asBool()); } vespalib::string -- cgit v1.2.3