From 11a6adc99f91e41a9fc444a5c7e3db506f679cc6 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Fri, 4 Dec 2020 16:33:53 +0100 Subject: Keep internal-redeploy serverside. Remove old restartOnDeploy implementation. --- config/abi-spec.json | 1 - config/src/apps/vespa-get-config/getconfig.cpp | 3 +-- .../config/subscription/ConfigSubscriber.java | 12 --------- .../subscription/impl/ConfigSubscription.java | 30 ++++++---------------- .../impl/GenericJRTConfigSubscription.java | 13 +--------- .../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/RawConfig.java | 22 ++++------------ .../vespa/config/protocol/ConfigResponse.java | 2 -- .../config/protocol/JRTClientConfigRequest.java | 3 --- .../config/protocol/JRTClientConfigRequestV3.java | 6 ----- .../config/protocol/JRTServerConfigRequest.java | 11 +------- .../config/protocol/JRTServerConfigRequestV3.java | 9 +------ .../vespa/config/protocol/SlimeConfigResponse.java | 15 ++--------- .../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 | 22 ++++++++-------- config/src/tests/configagent/configagent.cpp | 3 +-- config/src/tests/frt/frt.cpp | 8 +++--- config/src/vespa/config/common/configstate.h | 5 +--- config/src/vespa/config/frt/protocol.cpp | 1 - config/src/vespa/config/frt/protocol.h | 1 - .../src/vespa/config/frt/slimeconfigresponse.cpp | 1 - 27 files changed, 57 insertions(+), 162 deletions(-) (limited to 'config') diff --git a/config/abi-spec.json b/config/abi-spec.json index b60f9053642..a41df9aa60d 100644 --- a/config/abi-spec.json +++ b/config/abi-spec.json @@ -218,7 +218,6 @@ "public boolean isClosed()", "public com.yahoo.config.subscription.ConfigHandle subscribe(com.yahoo.config.subscription.ConfigSubscriber$SingleSubscriber, java.lang.Class, java.lang.String)", "public long getGeneration()", - "public boolean isInternalRedeploy()", "protected void finalize()" ], "fields": [ diff --git a/config/src/apps/vespa-get-config/getconfig.cpp b/config/src/apps/vespa-get-config/getconfig.cpp index 92966b934f1..65dc800c275 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, false); + ConfigState state(configMD5, generation, false); FRTConfigRequest::UP request = requestFactory.createConfigRequest(key, &connection, state, serverTimeout * 1000); _target->InvokeSync(request->getRequest(), clientTimeout); // seconds @@ -244,7 +244,6 @@ GetConfig::Main() printf("configMD5 %s\n", rState.md5.c_str()); printf("generation %" PRId64 "\n", rState.generation); - printf("internalRedeploy %s\n", rState.internalRedeploy == 0 ? "false" : "true"); printf("trace %s\n", response->getTrace().toString().c_str()); } else if (traceLevel > 0) { printf("trace %s\n", response->getTrace().toString().c_str()); 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 ad131f8e0dd..b4750eebfee 100644 --- a/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java +++ b/config/src/main/java/com/yahoo/config/subscription/ConfigSubscriber.java @@ -43,9 +43,6 @@ public class ConfigSubscriber implements AutoCloseable { /** The last complete config generation received by this */ private long generation = -1; - /** 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 @@ -262,7 +259,6 @@ public class ConfigSubscriber implements AutoCloseable { h.setChanged(false); // Reset this flag, if it was set, the user should have acted on it the last time this method returned true. } boolean reconfigDue; - boolean internalRedeployOnly = true; do { boolean allGenerationsChanged = true; boolean allGenerationsTheSame = true; @@ -279,7 +275,6 @@ public class ConfigSubscriber implements AutoCloseable { allGenerationsTheSame &= currentGen.equals(config.getGeneration()); allGenerationsChanged &= config.isGenerationChanged(); anyConfigChanged |= config.isConfigChanged(); - internalRedeployOnly &= config.isInternalRedeploy(); applyOnRestartOnly |= requireChange && config.applyOnRestart(); // only if this is reconfig timeLeftMillis = timeoutInMillis + started - System.currentTimeMillis(); } @@ -301,7 +296,6 @@ public class ConfigSubscriber implements AutoCloseable { // Also if appropriate update the changed flag on the handler, which clients use. markSubsChangedSeen(currentGen); synchronized (monitor) { - internalRedeploy = internalRedeployOnly; generation = currentGen; } } @@ -490,12 +484,6 @@ public class ConfigSubscriber implements AutoCloseable { } } - /** - * Whether the current config generation received by this was due to a system-internal redeploy, - * not an application package change - */ - public boolean isInternalRedeploy() { synchronized (monitor) { return internalRedeploy; } } - /** * Convenience interface for clients who only subscribe to one config. Implement this, and pass it to {@link ConfigSubscriber#subscribe(SingleSubscriber, Class, String)}. * 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 15f6395c417..07bbd950c83 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 @@ -39,29 +39,26 @@ public abstract class ConfigSubscription { private final boolean generationChanged; private final T config; private final Long generation; - private final boolean internalRedeploy; 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, false, config); + this(false, generation, false, false, config); } private ConfigState() { - this(false, 0L, false, false, false, null); + this(false, 0L, false, false, null); } private ConfigState createUnchanged() { return new ConfigState<>(generation, config); } @@ -69,12 +66,6 @@ public abstract class ConfigSubscription { public boolean isGenerationChanged() { return generationChanged; } public Long getGeneration() { return generation; } - /** - * Returns whether this config generation was caused by a system-internal redeploy, - * not an application package change - */ - public boolean isInternalRedeploy() { return internalRedeploy; } - public boolean applyOnRestart() { return applyOnRestart; } public T getConfig() { return config; } @@ -190,34 +181,29 @@ public abstract class ConfigSubscription { return !prev.getGeneration().equals(requiredGen) || prev.isConfigChanged(); } - void setConfig(Long generation, boolean internalRedeploy, boolean applyOnRestart, T config) { - this.config.set(new ConfigState<>(true, generation, internalRedeploy, applyOnRestart, true, config)); + void setConfig(Long generation, boolean applyOnRestart, T config) { + this.config.set(new ConfigState<>(true, generation, 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(), prev.applyOnRestart(), true, config)); + this.config.set(new ConfigState<>(true, prev.getGeneration() + 1, prev.applyOnRestart(), true, config)); } protected void setConfigIfChanged(T config) { ConfigState prev = this.config.get(); - this.config.set(new ConfigState<>(true, prev.getGeneration(), prev.isInternalRedeploy(), prev.applyOnRestart(), !config.equals(prev.getConfig()), config)); + this.config.set(new ConfigState<>(true, prev.getGeneration(), 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.applyOnRestart(), prev.isConfigChanged(), prev.getConfig())); - } - - void setInternalRedeploy(boolean internalRedeploy) { - ConfigState prev = config.get(); - this.config.set(new ConfigState<>(prev.isGenerationChanged(), prev.getGeneration(), internalRedeploy, prev.applyOnRestart(), prev.isConfigChanged(), prev.getConfig())); + this.config.set(new ConfigState<>(true, generation, 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())); + this.config.set(new ConfigState<>(prev.isGenerationChanged(), prev.getGeneration(), 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 ba8fc8a5e19..b052c79f429 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 @@ -32,7 +32,7 @@ public class GenericJRTConfigSubscription extends JRTConfigSubscription "in setNewConfig, config=" + this.getConfigState().getConfig()); } @@ -48,17 +48,6 @@ public class GenericJRTConfigSubscription extends JRTConfigSubscription configState = getConfigState(); - - if (configState.getConfig() != null) { - configState.getConfig().setInternalRedeploy(internalRedeploy); - } - } - // Override to propagate internal redeploy into the config value in addition to the config state @Override void setApplyOnRestart(boolean applyOnRestart) { 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 e9d5d317995..b48e5905239 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 @@ -93,7 +93,6 @@ 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); @@ -112,7 +111,7 @@ public class JRTConfigSubscription extends ConfigSubsc } catch (IllegalArgumentException e) { badConfigE = e; } - setConfig(jrtReq.getNewGeneration(), jrtReq.responseIsInternalRedeploy(), jrtReq.responseIsApplyOnRestart(), configInstance); + setConfig(jrtReq.getNewGeneration(), 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 9fc5d9d3300..05da9a72837 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, false, config); + setConfig(0L, 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 3a284489109..58eed7f9e78 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, false, ConfigUtils.getMd5(payload.getData())); + jrtReq.addOkResponse(payload, generation, 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 1ff0a058a93..68ff6bb0135 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, false, configPayload.toInstance(configClass, key.getConfigId())); + setConfig(0L, false, configPayload.toInstance(configClass, key.getConfigId())); return true; } try { 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 cf0f1243acf..1c28d4c5e05 100755 --- a/config/src/main/java/com/yahoo/vespa/config/RawConfig.java +++ b/config/src/main/java/com/yahoo/vespa/config/RawConfig.java @@ -31,7 +31,6 @@ public class RawConfig extends ConfigInstance { private final String configMd5; private final Optional vespaVersion; private long generation; - private boolean internalRedeploy; private boolean applyOnRestart; /** @@ -41,31 +40,30 @@ 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, false, 0, Collections.emptyList(), Optional.empty()); + this(key, defMd5, null, "", 0L, false, 0, Collections.emptyList(), Optional.empty()); } public RawConfig(ConfigKey key, String defMd5, Payload payload, String configMd5, long generation, - boolean internalRedeploy, boolean applyOnRestart, List defContent, + boolean applyOnRestart, List defContent, Optional vespaVersion) { - this(key, defMd5, payload, configMd5, generation, internalRedeploy, applyOnRestart, 0, defContent, vespaVersion); + this(key, defMd5, payload, configMd5, generation, applyOnRestart, 0, defContent, vespaVersion); } /** Copy constructor */ public RawConfig(RawConfig rawConfig) { this(rawConfig.key, rawConfig.defMd5, rawConfig.payload, rawConfig.configMd5, - rawConfig.generation, rawConfig.internalRedeploy, rawConfig.applyOnRestart, + rawConfig.generation, rawConfig.applyOnRestart, rawConfig.errorCode, rawConfig.defContent, rawConfig.getVespaVersion()); } public RawConfig(ConfigKey key, String defMd5, Payload payload, String configMd5, long generation, - boolean internalRedeploy, boolean applyOnRestart, int errorCode, List defContent, + 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; @@ -83,7 +81,6 @@ public class RawConfig extends ConfigInstance { req.getNewPayload(), req.getNewConfigMd5(), req.getNewGeneration(), - req.responseIsInternalRedeploy(), req.responseIsApplyOnRestart(), 0, req.getDefContent().asList(), @@ -101,7 +98,6 @@ public class RawConfig extends ConfigInstance { Payload.from(new Utf8String(""), CompressionInfo.uncompressed()), req.getRequestConfigMd5(), req.getRequestGeneration(), - req.isInternalRedeploy(), req.applyOnRestart(), 0, req.getDefContent().asList(), @@ -125,16 +121,8 @@ public class RawConfig extends ConfigInstance { public void setGeneration(long generation) { this.generation = generation; } - 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; } 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 27f4816849d..31e280e708c 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 @@ -20,8 +20,6 @@ public interface ConfigResponse { long getGeneration(); - boolean isInternalRedeploy(); - boolean applyOnRestart(); String getConfigMd5(); 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 8f85e2353a5..8535cc23225 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 @@ -53,9 +53,6 @@ public interface JRTClientConfigRequest extends JRTConfigRequest { */ long getNewGeneration(); - /** 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(); 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 e04a2179602..87e63399fc3 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 @@ -180,7 +180,6 @@ public class JRTClientConfigRequestV3 implements JRTClientConfigRequest { .append("'\n"); sb.append("response='").append(getNewConfigMd5()) .append(",").append(getNewGeneration()) - .append(",").append(responseIsInternalRedeploy()) .append(",").append(responseIsApplyOnRestart()) .append("'\n"); return sb.toString(); @@ -290,11 +289,6 @@ public class JRTClientConfigRequestV3 implements JRTClientConfigRequest { return responseData.getResponseConfigGeneration(); } - @Override - public boolean responseIsInternalRedeploy() { - return responseData.getResponseInternalRedeployment(); - } - @Override public boolean responseIsApplyOnRestart() { return responseData.getResponseApplyOnRestart(); 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 dbc6a7bb98d..c085be5924c 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 @@ -32,14 +32,11 @@ public interface JRTServerConfigRequest extends JRTConfigRequest, GetConfigReque * * @param payload The config payload that the client should receive. * @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, boolean applyOnRestart, - String configMd5); + void addOkResponse(Payload payload, long generation, boolean applyOnRestart, String configMd5); /** * Get the current config md5 of the client config. @@ -62,12 +59,6 @@ public interface JRTServerConfigRequest extends JRTConfigRequest, GetConfigReque */ boolean isDelayedResponse(); - /** - * Returns whether the response config was created by a system internal redeploy, not an application - * package change - */ - boolean isInternalRedeploy(); - boolean applyOnRestart(); /** 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 0bc7c44fe9d..53a2f4019f9 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 @@ -36,7 +36,6 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { protected final Request request; private final SlimeRequestData requestData; /** Response field */ - private boolean internalRedeploy = false; private boolean applyOnRestart = false; // Response values private boolean isDelayed = false; @@ -68,9 +67,7 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { } @Override - public void addOkResponse(Payload payload, long generation, boolean internalRedeploy, boolean applyOnRestart, - String configMd5) { - this.internalRedeploy = internalRedeploy; + public void addOkResponse(Payload payload, long generation, boolean applyOnRestart, String configMd5) { this.applyOnRestart = applyOnRestart; boolean changedConfig = !configMd5.equals(getRequestConfigMd5()); boolean changedConfigAndNewGeneration = changedConfig && ConfigUtils.isGenerationNewer(generation, getRequestGeneration()); @@ -82,7 +79,6 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { addCommonReturnValues(jsonGenerator); 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) { @@ -114,9 +110,6 @@ public class JRTServerConfigRequestV3 implements JRTServerConfigRequest { return 3; } - @Override - public boolean isInternalRedeploy() { return internalRedeploy; } - @Override public boolean applyOnRestart() { return applyOnRestart; } 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 8bdd336fd5c..1fec7e17d06 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 @@ -17,28 +17,24 @@ public class SlimeConfigResponse implements ConfigResponse { private final Utf8Array payload; 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, boolean applyOnRestart, - String configMd5) { + boolean applyOnRestart, String configMd5) { Utf8Array data = payload.toUtf8Array(true); - return new SlimeConfigResponse(data, generation, internalRedeploy, applyOnRestart, + return new SlimeConfigResponse(data, generation, applyOnRestart, configMd5, CompressionInfo.create(CompressionType.UNCOMPRESSED, data.getByteLength())); } 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; @@ -54,13 +50,6 @@ public class SlimeConfigResponse implements ConfigResponse { return generation; } - /** - * Returns whether this application instance was produced by an internal redeployment, - * not an application package change - */ - @Override - public boolean isInternalRedeploy() { return internalRedeploy; } - @Override public boolean applyOnRestart() { return applyOnRestart; } 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 1c9afa550d4..cc98587456c 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 @@ -23,7 +23,6 @@ class SlimeResponseData { static final String RESPONSE_TRACE = "trace"; 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"; @@ -68,11 +67,6 @@ class SlimeResponseData { return CompressionInfo.fromSlime(getResponseField(RESPONSE_COMPRESSION_INFO)); } - boolean getResponseInternalRedeployment() { - Inspector inspector = getResponseField(RESPONSE_INTERNAL_REDEPLOY); - 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 07ff27a0154..4211345dff7 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, false, config()); + sub.setConfig(1L, 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, false, config()); + sub.setConfig(1L, 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, false, config()); + sub.setConfig(1L, 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 9fd0b9ba1fa..e1d11f82eea 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, false, defContent, Optional.empty()); - RawConfig config2 = new RawConfig(key, defMd5, payload, configMd5, 2L, false, false, defContent, Optional.empty()); + 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()); 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, false, defContent, Optional.of(vespaVersion)); + RawConfig config3 = new RawConfig(key, defMd5, payload, "9999", generation, 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, false, 1, defContent, Optional.empty()); + RawConfig errorConfig1 = new RawConfig(key, defMd5, payload, configMd5, generation, 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, false, 2, defContent, Optional.empty()); + RawConfig errorConfig2 = new RawConfig(key, defMd5, payload, configMd5, generation, 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, false, defContent, Optional.empty()); + RawConfig config = new RawConfig(key, defMd5, payload, configMd5, generation, 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, false, defContent, Optional.empty()); + RawConfig config = new RawConfig(key, null, payload, configMd5, generation, false, defContent, Optional.empty()); assertThat(config.getDefMd5(), is(defMd5)); - config = new RawConfig(key, "", payload, configMd5, generation, false, false, defContent, Optional.empty()); + config = new RawConfig(key, "", payload, configMd5, generation, false, defContent, Optional.empty()); assertThat(config.getDefMd5(), is(defMd5)); - config = new RawConfig(key, defMd5, payload, configMd5, generation, false, false, defContent, Optional.empty()); + config = new RawConfig(key, defMd5, payload, configMd5, generation, false, defContent, Optional.empty()); assertThat(config.getDefMd5(), is(defMd5)); - config = new RawConfig(key, null, payload, configMd5, generation, false, false, null, Optional.empty()); + config = new RawConfig(key, null, payload, configMd5, generation, false, null, Optional.empty()); assertNull(config.getDefMd5()); - config = new RawConfig(key, null, payload, configMd5, generation, false,false, List.of(""), Optional.empty()); + config = new RawConfig(key, null, payload, configMd5, generation, false, List.of(""), Optional.empty()); assertThat(config.getDefMd5(), is(defMd5ForEmptyDefContent)); - config = new RawConfig(key, "", payload, configMd5, generation, false, false, null, Optional.empty()); + config = new RawConfig(key, "", payload, configMd5, generation, false, null, Optional.empty()); assertThat(config.getDefMd5(), is("")); - config = new RawConfig(key, "", payload, configMd5, generation, false, false, List.of(""), Optional.empty()); + config = new RawConfig(key, "", payload, configMd5, generation, 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 98eda868bbf..a56c7ef2daa 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, false, "mymd5"); + ConfigResponse response = SlimeConfigResponse.fromConfigPayload(configPayload, 3, 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, false, "mymd5", CompressionInfo.create(CompressionType.LZ4, data.getByteLength())); + ConfigResponse response = new SlimeConfigResponse(bytes, 3, 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 6fc55e60a54..006a6fc6a0a 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 @@ -28,6 +28,7 @@ import java.util.Collections; import java.util.Optional; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; @@ -73,12 +74,11 @@ public class JRTConfigRequestV3Test { @Test public void emptypayload() { ConfigPayload payload = ConfigPayload.empty(); - SlimeConfigResponse response = SlimeConfigResponse.fromConfigPayload(payload, 0, false, false, ConfigUtils.getMd5(payload)); - serverReq.addOkResponse(serverReq.payloadFromResponse(response), response.getGeneration(), false, false, response.getConfigMd5()); + SlimeConfigResponse response = SlimeConfigResponse.fromConfigPayload(payload, 0, false, ConfigUtils.getMd5(payload)); + serverReq.addOkResponse(serverReq.payloadFromResponse(response), response.getGeneration(), false, response.getConfigMd5()); assertTrue(clientReq.validateResponse()); assertTrue(clientReq.hasUpdatedGeneration()); - assertThat(clientReq.getNewPayload().withCompression(CompressionType.UNCOMPRESSED).getData().toString(), is("{}")); - assertFalse(clientReq.responseIsInternalRedeploy()); + assertEquals("{}", clientReq.getNewPayload().withCompression(CompressionType.UNCOMPRESSED).getData().toString()); } @Test @@ -92,11 +92,9 @@ public class JRTConfigRequestV3Test { @Test public void next_request_when_error_is_correct() { - serverReq.addOkResponse(createPayload(), 999999, false, false, "newmd5"); + serverReq.addOkResponse(createPayload(), 999999, false, "newmd5"); serverReq.addErrorResponse(ErrorCode.OUTDATED_CONFIG, "error message"); - System.out.println(serverReq); JRTClientConfigRequest next = clientReq.nextRequest(6); - System.out.println(next); // Should use config md5 and generation from the request, not the response // when there are errors assertThat(next.getRequestConfigMd5(), is(clientReq.getRequestConfigMd5())); @@ -108,7 +106,7 @@ public class JRTConfigRequestV3Test { Payload payload = createPayload("vale"); String md5 = ConfigUtils.getMd5(payload.getData()); long generation = 4L; - serverReq.addOkResponse(payload, generation, false, false, md5); + serverReq.addOkResponse(payload, generation, false, md5); assertTrue(clientReq.validateResponse()); assertThat(clientReq.getNewPayload().withCompression(CompressionType.UNCOMPRESSED).getData().toString(), is(payload.getData().toString())); assertThat(clientReq.getNewGeneration(), is(4L)); @@ -134,7 +132,7 @@ public class JRTConfigRequestV3Test { @Test public void generation_only_is_updated() { Payload payload = createPayload(); - serverReq.addOkResponse(payload, 4L, false, false, ConfigUtils.getMd5(payload.getData())); + serverReq.addOkResponse(payload, 4L, false, ConfigUtils.getMd5(payload.getData())); boolean value = clientReq.validateResponse(); assertTrue(clientReq.errorMessage(), value); assertFalse(clientReq.hasUpdatedConfig()); @@ -144,7 +142,7 @@ public class JRTConfigRequestV3Test { @Test public void nothing_is_updated() { Payload payload = createPayload(); - serverReq.addOkResponse(payload, currentGeneration, false, false, configMd5); + serverReq.addOkResponse(payload, currentGeneration, false, configMd5); assertTrue(clientReq.validateResponse()); assertFalse(clientReq.hasUpdatedConfig()); assertFalse(clientReq.hasUpdatedGeneration()); @@ -155,7 +153,7 @@ public class JRTConfigRequestV3Test { Payload payload = Payload.from(ConfigPayload.empty()); clientReq = createReq(payload); serverReq = createReq(clientReq.getRequest()); - serverReq.addOkResponse(payload, currentGeneration, false, false, ConfigUtils.getMd5(payload.getData())); + serverReq.addOkResponse(payload, currentGeneration, false, ConfigUtils.getMd5(payload.getData())); boolean val = clientReq.validateResponse(); assertTrue(clientReq.errorMessage(), val); assertFalse(clientReq.hasUpdatedConfig()); @@ -192,7 +190,7 @@ public class JRTConfigRequestV3Test { @Override public void createResponse() { JRTServerConfigRequest serverRequest = createReq(request); - serverRequest.addOkResponse(createPayload(), currentGeneration, false, false, configMd5); + serverRequest.addOkResponse(createPayload(), currentGeneration, false, configMd5); } }); diff --git a/config/src/tests/configagent/configagent.cpp b/config/src/tests/configagent/configagent.cpp index 7cc0abee0bc..d6766cce822 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, false), + _state(md5, timestamp, false), _errorMessage(errorMsg), _errorCode(errorC0de), _isError(iserror) @@ -141,7 +141,6 @@ TEST("require that agent returns correct values") { ConfigState cs; 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); } diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp index 60973aea2bf..0d70605fa62 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, 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))); + 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))); 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 155c182271b..2dbea3cc30f 100644 --- a/config/src/vespa/config/common/configstate.h +++ b/config/src/vespa/config/common/configstate.h @@ -15,19 +15,16 @@ public: ConfigState() : md5(""), generation(0), - internalRedeploy(false), applyOnRestart(false) { } - ConfigState(const vespalib::string & md5sum, int64_t gen, bool _internalRedeploy, bool _applyOnRestart) + ConfigState(const vespalib::string & md5sum, int64_t gen, bool _applyOnRestart) : md5(md5sum), generation(gen), - internalRedeploy(_internalRedeploy), applyOnRestart(_applyOnRestart) { } vespalib::string md5; int64_t generation; - bool internalRedeploy; bool applyOnRestart; bool isNewerGenerationThan(const ConfigState & other) const { diff --git a/config/src/vespa/config/frt/protocol.cpp b/config/src/vespa/config/frt/protocol.cpp index 5019cce23c5..269c3477ba8 100644 --- a/config/src/vespa/config/frt/protocol.cpp +++ b/config/src/vespa/config/frt/protocol.cpp @@ -40,7 +40,6 @@ const Memory RESPONSE_CONFIG_MD5 = "configMD5"; 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 & diff --git a/config/src/vespa/config/frt/protocol.h b/config/src/vespa/config/frt/protocol.h index a7465ef979d..0ec16952701 100644 --- a/config/src/vespa/config/frt/protocol.h +++ b/config/src/vespa/config/frt/protocol.h @@ -52,7 +52,6 @@ extern const vespalib::Memory RESPONSE_CONFIG_MD5; 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 f778fe574f1..af224008d01 100644 --- a/config/src/vespa/config/frt/slimeconfigresponse.cpp +++ b/config/src/vespa/config/frt/slimeconfigresponse.cpp @@ -68,7 +68,6 @@ 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(), data.get()[RESPONSE_APPLY_ON_RESTART].asBool()); } -- cgit v1.2.3