Skip to content

Commit 839077c

Browse files
send notification for verified backups (#1090)
1 parent 5ce3496 commit 839077c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

priam/src/main/java/com/netflix/priam/resources/BackupServletV2.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.netflix.priam.backupv2.IMetaProxy;
2424
import com.netflix.priam.backupv2.SnapshotMetaTask;
2525
import com.netflix.priam.config.IConfiguration;
26+
import com.netflix.priam.notification.BackupNotificationMgr;
2627
import com.netflix.priam.utils.DateUtil;
2728
import com.netflix.priam.utils.DateUtil.DateRange;
2829
import com.netflix.priam.utils.GsonJsonSerializer;
@@ -53,6 +54,7 @@ public class BackupServletV2 {
5354
private final IMetaProxy metaProxy;
5455
private final Provider<AbstractBackupPath> pathProvider;
5556
private final BackupV2Service backupService;
57+
private final BackupNotificationMgr backupNotificationMgr;
5658
private static final String REST_SUCCESS = "[\"ok\"]";
5759

5860
@Inject
@@ -65,7 +67,8 @@ public BackupServletV2(
6567
IBackupFileSystem fileSystem,
6668
@Named("v2") IMetaProxy metaV2Proxy,
6769
Provider<AbstractBackupPath> pathProvider,
68-
BackupV2Service backupService) {
70+
BackupV2Service backupService,
71+
BackupNotificationMgr backupNotificationMgr) {
6972
this.backupStatusMgr = backupStatusMgr;
7073
this.backupVerification = backupVerification;
7174
this.snapshotMetaService = snapshotMetaService;
@@ -74,6 +77,7 @@ public BackupServletV2(
7477
this.metaProxy = metaV2Proxy;
7578
this.pathProvider = pathProvider;
7679
this.backupService = backupService;
80+
this.backupNotificationMgr = backupNotificationMgr;
7781
}
7882

7983
@GET
@@ -131,6 +135,17 @@ public Response validateV2SnapshotByDate(
131135
.build();
132136
}
133137

138+
// Send notification for any verified backups. This is useful in one-off backup consumption
139+
// by downward dependencies.
140+
// Side-effect: It may send notification for already verified snapshot i.e. duplicate
141+
// message may be sent.
142+
logger.info(
143+
"Sending {} message for backup: {}",
144+
AbstractBackupPath.BackupFileType.SNAPSHOT_VERIFIED,
145+
result.get().remotePath);
146+
147+
backupNotificationMgr.notify(result.get().remotePath, result.get().snapshotInstant);
148+
134149
return Response.ok(result.get().toString()).build();
135150
}
136151

0 commit comments

Comments
 (0)