diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-08-18 06:34:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-18 06:34:48 +0200 |
commit | 314139e36ee0542edde85292c68e9c2735473f57 (patch) | |
tree | f6e8672f94505d35ebecc7e9ed6536efa26b9c73 /configserver/src | |
parent | 88e293db7cb6480d6970511350fc18709309b2c1 (diff) |
Revert "Remove fallback to default application id"
Diffstat (limited to 'configserver/src')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java index 076fe70db4d..a96ae16a20b 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java @@ -389,25 +389,27 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener { * Returns the context for this request, or null if the server is not properly set up with handlers */ GetConfigContext createGetConfigContext(Optional<TenantName> optionalTenant, JRTServerConfigRequest request, Trace trace) { - if ("*".equals(request.getConfigKey().getConfigId())) + if ("*".equals(request.getConfigKey().getConfigId())) { return GetConfigContext.create(ApplicationId.global(), superModelRequestHandler, trace); - - String clientHostName = request.getClientHostName(); - Optional<RequestHandler> requestHandler = optionalTenant.flatMap(this::getRequestHandler); + } + // TODO: Look into if this fallback really is needed + TenantName tenant = optionalTenant.orElse(TenantName.defaultName()); + Optional<RequestHandler> requestHandler = getRequestHandler(tenant); if (requestHandler.isEmpty()) { - String msg = "Unable to find request handler for tenant '" + optionalTenant + - "'. Request from host '" + clientHostName + "'"; + String msg = TenantRepository.logPre(tenant) + "Unable to find request handler for tenant '" + tenant + + "'. Request from host '" + request.getClientHostName() + "'"; metrics.incUnknownHostRequests(); trace.trace(TRACELEVEL, msg); log.log(Level.WARNING, msg); return null; } - RequestHandler handler = requestHandler.get(); - ApplicationId applicationId = handler.resolveApplicationId(clientHostName); - if (applicationId == null) throw new RuntimeException("Could not find application for request from " + clientHostName); + ApplicationId applicationId = handler.resolveApplicationId(request.getClientHostName()); + // TODO: Look into if this fallback really is needed + if (applicationId == null && tenant.equals(TenantName.defaultName())) + applicationId = ApplicationId.defaultId(); if (trace.shouldTrace(TRACELEVEL_DEBUG)) { - trace.trace(TRACELEVEL_DEBUG, "Host '" + clientHostName + "' should have config from application '" + applicationId + "'"); + trace.trace(TRACELEVEL_DEBUG, "Host '" + request.getClientHostName() + "' should have config from application '" + applicationId + "'"); } return GetConfigContext.create(applicationId, handler, trace); } |