summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java29
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java1
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java16
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java28
4 files changed, 23 insertions, 51 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java
index a5938c3b6b5..1c697baa3f6 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ApplicationStore.java
@@ -35,27 +35,18 @@ public interface ApplicationStore {
return find(tenant, application, buildNumber).isPresent();
}
- /** Stores the given tenant application package of the given version and diff since previous version. */
- void put(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion, byte[] applicationPackage, byte[] diff);
+ /** Stores the given tenant application and test packages of the given revision, and diff since previous version. */
+ void put(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion, byte[] applicationPackage, byte[] testPackage, byte[] diff);
- /** Removes applications older than the given version, for the given application, and returns whether something was removed. */
- boolean prune(TenantName tenant, ApplicationName application, ApplicationVersion olderThanVersion);
+ /** Removes application and test packages older than the given version, for the given application. */
+ void prune(TenantName tenant, ApplicationName application, ApplicationVersion olderThanVersion);
- /** Removes all application packages for the given application, including any development package. */
+ /** Removes all application and test packages for the given application, including any development package. */
void removeAll(TenantName tenant, ApplicationName application);
/** Returns the tester application package of the given version. Does NOT contain the services.xml. */
byte[] getTester(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion);
- /** Stores the given tester application package of the given version. Does NOT contain the services.xml. */
- void putTester(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion, byte[] testerPackage);
-
- /** Removes tester packages older than the given version, for the given tester, and returns whether something was removed. */
- boolean pruneTesters(TenantName tenant, ApplicationName application, ApplicationVersion olderThanVersion);
-
- /** Removes all tester packages for the given tester. */
- void removeAllTesters(TenantName tenant, ApplicationName application);
-
/** Returns the application package diff, compared to the previous build, for the given deployment and build number */
Optional<byte[]> getDevDiff(DeploymentId deploymentId, long buildNumber);
@@ -65,19 +56,19 @@ public interface ApplicationStore {
/** Stores the given application package as the development package for the given deployment and version and diff since previous version. */
void putDev(DeploymentId deploymentId, ApplicationVersion version, byte[] applicationPackage, byte[] diff);
- /** Stores the given application meta data with the current time as part of the path. */
+ /** Stores the given application metadata with the current time as part of the path. */
void putMeta(TenantName tenant, ApplicationName application, Instant now, byte[] metaZip);
- /** Marks the given application as deleted, and eligible for meta data GC at a later time. */
+ /** Marks the given application as deleted, and eligible for metadata GC at a later time. */
void putMetaTombstone(TenantName tenant, ApplicationName application, Instant now);
- /** Stores the given manual deployment meta data with the current time as part of the path. */
+ /** Stores the given manual deployment metadata with the current time as part of the path. */
void putMeta(DeploymentId id, Instant now, byte[] metaZip);
- /** Marks the given manual deployment as deleted, and eligible for meta data GC at a later time. */
+ /** Marks the given manual deployment as deleted, and eligible for metadata GC at a later time. */
void putMetaTombstone(DeploymentId id, Instant now);
- /** Prunes meta data such that only what was active at the given instant, and anything newer, is retained. */
+ /** Prunes metadata such that only what was active at the given instant, and anything newer, is retained. */
void pruneMeta(Instant oldest);
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
index 30648265ab9..01abca1b2be 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
@@ -705,7 +705,6 @@ public class ApplicationController {
}
applicationStore.removeAll(id.tenant(), id.application());
- applicationStore.removeAllTesters(id.tenant(), id.application());
applicationStore.putMetaTombstone(id.tenant(), id.application(), clock.instant());
credentials.ifPresent(creds -> accessControl.deleteApplication(id, creds));
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java
index 1806cd04389..8878b081cca 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/JobController.java
@@ -236,7 +236,7 @@ public class JobController {
}
/** Returns all job types which have been run for the given application. */
- public List<JobType> jobs(ApplicationId id) {
+ private List<JobType> jobs(ApplicationId id) {
return JobType.allIn(controller.system()).stream()
.filter(type -> last(id, type).isPresent())
.collect(toUnmodifiableList());
@@ -464,14 +464,11 @@ public class JobController {
byte[] diff = previousPackage.map(previous -> ApplicationPackageDiff.diff(previous, applicationPackage))
.orElseGet(() -> ApplicationPackageDiff.diffAgainstEmpty(applicationPackage));
applications.applicationStore().put(id.tenant(),
- id.application(),
- version.get(),
- applicationPackage.zippedContent(),
- diff);
- applications.applicationStore().putTester(id.tenant(),
- id.application(),
- version.get(),
- testPackageBytes);
+ id.application(),
+ version.get(),
+ applicationPackage.zippedContent(),
+ testPackageBytes,
+ diff);
applications.applicationStore().putMeta(id.tenant(),
id.application(),
controller.clock().instant(),
@@ -492,7 +489,6 @@ public class JobController {
Optional<ApplicationVersion> oldestDeployed = application.get().oldestDeployedApplication();
if (oldestDeployed.isPresent()) {
controller.applications().applicationStore().prune(id.tenant(), id.application(), oldestDeployed.get());
- controller.applications().applicationStore().pruneTesters(id.tenant(), id.application(), oldestDeployed.get());
for (ApplicationVersion version : application.get().revisions().withPackage())
if (version.compareTo(oldestDeployed.get()) < 0)
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java
index bedae15824f..3dbe307fa5a 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ApplicationStoreMock.java
@@ -77,21 +77,23 @@ public class ApplicationStoreMock implements ApplicationStore {
}
@Override
- public void put(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion, byte[] applicationPackage, byte[] diff) {
- store.computeIfAbsent(appId(tenant, application), __ -> new ConcurrentHashMap<>()).put(applicationVersion, applicationPackage);
+ public void put(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion, byte[] bytes, byte[] tests, byte[] diff) {
+ store.computeIfAbsent(appId(tenant, application), __ -> new ConcurrentHashMap<>()).put(applicationVersion, bytes);
+ store.computeIfAbsent(testerId(tenant, application), key -> new ConcurrentHashMap<>()) .put(applicationVersion, tests);
applicationVersion.buildNumber().ifPresent(buildNumber ->
diffs.computeIfAbsent(appId(tenant, application), __ -> new ConcurrentHashMap<>()).put(buildNumber, diff));
}
@Override
- public boolean prune(TenantName tenant, ApplicationName application, ApplicationVersion oldestToRetain) {
- return store.containsKey(appId(tenant, application))
- && store.get(appId(tenant, application)).keySet().removeIf(version -> version.compareTo(oldestToRetain) < 0);
+ public void prune(TenantName tenant, ApplicationName application, ApplicationVersion oldestToRetain) {
+ store.getOrDefault(appId(tenant, application), Map.of()).keySet().removeIf(version -> version.compareTo(oldestToRetain) < 0);
+ store.getOrDefault(testerId(tenant, application), Map.of()).keySet().removeIf(version -> version.compareTo(oldestToRetain) < 0);
}
@Override
public void removeAll(TenantName tenant, ApplicationName application) {
store.remove(appId(tenant, application));
+ store.remove(testerId(tenant, application));
}
@Override
@@ -99,22 +101,6 @@ public class ApplicationStoreMock implements ApplicationStore {
return requireNonNull(store.get(testerId(tenant, application)).get(applicationVersion));
}
- @Override
- public void putTester(TenantName tenant, ApplicationName application, ApplicationVersion applicationVersion, byte[] testerPackage) {
- store.computeIfAbsent(testerId(tenant, application), key -> new ConcurrentHashMap<>())
- .put(applicationVersion, testerPackage);
- }
-
- @Override
- public boolean pruneTesters(TenantName tenant, ApplicationName application, ApplicationVersion oldestToRetain) {
- return store.containsKey(testerId(tenant, application))
- && store.get(testerId(tenant, application)).keySet().removeIf(version -> version.compareTo(oldestToRetain) < 0);
- }
-
- @Override
- public void removeAllTesters(TenantName tenant, ApplicationName application) {
- store.remove(testerId(tenant, application));
- }
@Override
public Optional<byte[]> getDevDiff(DeploymentId deploymentId, long buildNumber) {