summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-05-07 11:43:59 +0200
committerGitHub <noreply@github.com>2021-05-07 11:43:59 +0200
commit69a56ad6265b1bc1a1d330580a5795c0f48e9eb5 (patch)
tree7b078146676905f1265be1028b56a5ee05611ca7
parent7984fa0ad2f31e101820edfd085decdf8afc6a9b (diff)
parent4404cbe94dfdb30f5229040450d92b4fad5933aa (diff)
Merge pull request #17769 from vespa-engine/freva/remove-migration
Remove temporary notifications DB cleanup
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java19
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java13
2 files changed, 0 insertions, 32 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
index e6435178d08..9fb39640833 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.controller.notification;
import com.yahoo.collections.Pair;
import com.yahoo.config.provision.ClusterSpec;
-import com.yahoo.config.provision.TenantName;
import com.yahoo.vespa.curator.Lock;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics;
@@ -39,24 +38,6 @@ public class NotificationsDb {
NotificationsDb(Clock clock, CuratorDb curatorDb) {
this.clock = clock;
this.curatorDb = curatorDb;
-
- removeApplicationPackageNotificationsWithInstanceSource();
- }
-
- // TODO (valerijf): Remove after 7.399
- void removeApplicationPackageNotificationsWithInstanceSource() {
- for (TenantName tenant : curatorDb.listNotifications()) {
- try (Lock lock = curatorDb.lockNotifications(tenant)) {
- List<Notification> initial = curatorDb.readNotifications(tenant);
- List<Notification> filtered = initial.stream()
- .filter(notification -> notification.type() != Type.applicationPackage ||
- notification.source().instance().isEmpty() ||
- notification.source().zoneId().isPresent())
- .collect(Collectors.toUnmodifiableList());
- if (initial.size() > filtered.size())
- curatorDb.writeNotifications(tenant, filtered);
- }
- }
}
public List<Notification> listNotifications(NotificationSource source, boolean productionOnly) {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
index 9f07f784dbf..5bd7d1db769 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
@@ -50,19 +50,6 @@ public class NotificationsDbTest {
private final NotificationsDb notificationsDb = new NotificationsDb(clock, curatorDb);
@Test
- public void clears_old_application_package_notifications() {
- List<Notification> allNotifications = new ArrayList<>(notifications);
- allNotifications.add(notification(1601, Type.applicationPackage, Level.warning, NotificationSource.from(ApplicationId.from("tenant1", "app1", "instance1")), "msg"));
- allNotifications.add(notification(1701, Type.applicationPackage, Level.warning, NotificationSource.from(new DeploymentId(ApplicationId.from("tenant1", "app1", "instance1"), ZoneId.from("dev", "us-south-3"))), "msg"));
- curatorDb.writeNotifications(tenant, allNotifications);
-
- assertEquals(allNotifications, notificationsDb.listNotifications(NotificationSource.from(tenant), false));
- notificationsDb.removeApplicationPackageNotificationsWithInstanceSource();
- allNotifications.remove(6);
- assertEquals(allNotifications, notificationsDb.listNotifications(NotificationSource.from(tenant), false));
- }
-
- @Test
public void list_test() {
assertEquals(notifications, notificationsDb.listNotifications(NotificationSource.from(tenant), false));
assertEquals(notificationIndices(0, 1, 2, 3), notificationsDb.listNotifications(NotificationSource.from(tenant), true));