summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-08-04 09:41:19 +0200
committerGitHub <noreply@github.com>2020-08-04 09:41:19 +0200
commiteb039ff41f1e612f7012af81950255933f2671b8 (patch)
tree841e2d97cca1520edbd2a27bf9dd501acbea4158 /configserver
parentca19241656265914c7f1221e4ca1af0ce7ce85c7 (diff)
parent59155208864186e25bdadfa7f14044c5a19f8a37 (diff)
Merge pull request #13973 from vespa-engine/hmusum/fallback-to-default-application-id-only-if-tenant-is-default
Fallback to default application id only for default tenant
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java6
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java2
3 files changed, 7 insertions, 7 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java
index 5567de6dadc..ba3b6f71b4b 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java
@@ -395,11 +395,7 @@ public class TenantApplications implements RequestHandler, HostValidator<Applica
@Override
public ApplicationId resolveApplicationId(String hostName) {
- ApplicationId applicationId = hostRegistry.getKeyForHost(hostName);
- if (applicationId == null) {
- applicationId = ApplicationId.defaultId();
- }
- return applicationId;
+ return hostRegistry.getKeyForHost(hostName);
}
@Override
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 a6c12f49a8e..388ddb4048c 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
@@ -392,7 +392,8 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
if ("*".equals(request.getConfigKey().getConfigId())) {
return GetConfigContext.create(ApplicationId.global(), superModelRequestHandler, trace);
}
- TenantName tenant = optionalTenant.orElse(TenantName.defaultName()); // perhaps needed for non-hosted?
+ // 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 = TenantRepository.logPre(tenant) + "Unable to find request handler for tenant '" + tenant +
@@ -404,6 +405,9 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener {
}
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();
if (trace.shouldTrace(TRACELEVEL_DEBUG)) {
trace.trace(TRACELEVEL_DEBUG, "Host '" + request.getClientHostName() + "' should have config from application '" + applicationId + "'");
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
index 6f60b0255b8..50a8cac2837 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
@@ -600,7 +600,7 @@ public class ApplicationRepositoryTest {
assertEquals(1330, config2.intval());
assertTrue(requestHandler.hasApplication(applicationId(), Optional.of(vespaVersion)));
- assertThat(requestHandler.resolveApplicationId("doesnotexist"), Is.is(ApplicationId.defaultId()));
+ assertNull(requestHandler.resolveApplicationId("doesnotexist"));
assertThat(requestHandler.resolveApplicationId("mytesthost"), Is.is(new ApplicationId.Builder()
.tenant(tenant1)
.applicationName("testapp").build())); // Host set in application package.