summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-08-17 10:54:10 +0200
committerHarald Musum <musum@verizonmedia.com>2020-08-17 10:54:10 +0200
commit97092cdc7891014130c5dc09ee514b4758aa96dc (patch)
tree12a520e7c68d33d674fd30fc1f6a1758b9b6a942 /configserver
parent0f03e049eaa576fadd4c3e459148099a7fc6b126 (diff)
Remove fallback to default application id
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java22
1 files changed, 10 insertions, 12 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 a96ae16a20b..076fe70db4d 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,27 +389,25 @@ 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);
- }
- // TODO: Look into if this fallback really is needed
- TenantName tenant = optionalTenant.orElse(TenantName.defaultName());
- Optional<RequestHandler> requestHandler = getRequestHandler(tenant);
+
+ String clientHostName = request.getClientHostName();
+ Optional<RequestHandler> requestHandler = optionalTenant.flatMap(this::getRequestHandler);
if (requestHandler.isEmpty()) {
- String msg = TenantRepository.logPre(tenant) + "Unable to find request handler for tenant '" + tenant +
- "'. Request from host '" + request.getClientHostName() + "'";
+ String msg = "Unable to find request handler for tenant '" + optionalTenant +
+ "'. Request from host '" + clientHostName + "'";
metrics.incUnknownHostRequests();
trace.trace(TRACELEVEL, msg);
log.log(Level.WARNING, msg);
return null;
}
+
RequestHandler handler = requestHandler.get();
- 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();
+ ApplicationId applicationId = handler.resolveApplicationId(clientHostName);
+ if (applicationId == null) throw new RuntimeException("Could not find application for request from " + clientHostName);
if (trace.shouldTrace(TRACELEVEL_DEBUG)) {
- trace.trace(TRACELEVEL_DEBUG, "Host '" + request.getClientHostName() + "' should have config from application '" + applicationId + "'");
+ trace.trace(TRACELEVEL_DEBUG, "Host '" + clientHostName + "' should have config from application '" + applicationId + "'");
}
return GetConfigContext.create(applicationId, handler, trace);
}