summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-12-01 18:47:38 +0100
committerJon Bratseth <bratseth@gmail.com>2020-12-01 18:47:38 +0100
commit9cfc48f97a23255971415bea04885d2823bfda89 (patch)
tree0d33ae9f5a152e2afdce429216d9c0c5d1b9f405 /configserver
parent11e4c93f4ee491d7814f91013204d4693b429500 (diff)
Fallback to old method
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/application/Application.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/Application.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/Application.java
index c82431dc8cd..156b4be392e 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/Application.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/Application.java
@@ -102,6 +102,7 @@ public class Application implements ModelResult {
/**
* Gets a config from ZK. Returns null if not found.
*/
+ @SuppressWarnings("deprecation")
public ConfigResponse resolveConfig(GetConfigRequest req, ConfigResponseFactory responseFactory) {
long start = System.currentTimeMillis();
metricUpdater.incrementRequests();
@@ -137,15 +138,23 @@ public class Application implements ModelResult {
ConfigInstance.Builder builder;
ConfigPayload payload;
+ boolean applyOnRestart = false;
try {
builder = model.getConfigInstance(configKey, def);
- if (builder instanceof GenericConfig.GenericConfigBuilder) {
+ if (builder == null) { // TODO: Remove this condition after December 2020
+ payload = model.getConfig(configKey, def);
+ if (def.getCNode() != null)
+ payload.applyDefaultsFromDef(def.getCNode());
+ }
+ else if (builder instanceof GenericConfig.GenericConfigBuilder) {
payload = ((GenericConfig.GenericConfigBuilder) builder).getPayload();
+ applyOnRestart = builder.getApplyOnRestart();
}
else {
try {
ConfigInstance instance = ConfigInstanceBuilder.buildInstance(builder, def.getCNode());
payload = ConfigPayload.fromInstance(instance);
+ applyOnRestart = builder.getApplyOnRestart();
} catch (ConfigurationRuntimeException e) {
// This can happen in cases where services ask for config that no longer exist before they have been able
// to reconfigure themselves
@@ -163,7 +172,7 @@ public class Application implements ModelResult {
ConfigResponse configResponse = responseFactory.createResponse(payload,
applicationGeneration,
internalRedeploy,
- builder.getApplyOnRestart());
+ applyOnRestart);
metricUpdater.incrementProcTime(System.currentTimeMillis() - start);
if (useCache(req)) {
cache.put(cacheKey, configResponse, configResponse.getConfigMd5());