summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-08-17 22:09:04 +0200
committerGitHub <noreply@github.com>2020-08-17 22:09:04 +0200
commit129e53226bb499e20f715c2f2c176544cb113974 (patch)
tree258e8e4c77b8db0e91c15b62379b9709a9e4d778 /configserver
parent5dc7ba73e714b47fe4a16eb59a5fb16ce4c6323c (diff)
parent97092cdc7891014130c5dc09ee514b4758aa96dc (diff)
Merge pull request #14059 from vespa-engine/hmusum/remove-fallback-to-default-application-id
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);
}