Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send notification for verified backups #1090

Merged
merged 1 commit into from Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -23,6 +23,7 @@
import com.netflix.priam.backupv2.IMetaProxy;
import com.netflix.priam.backupv2.SnapshotMetaTask;
import com.netflix.priam.config.IConfiguration;
import com.netflix.priam.notification.BackupNotificationMgr;
import com.netflix.priam.utils.DateUtil;
import com.netflix.priam.utils.DateUtil.DateRange;
import com.netflix.priam.utils.GsonJsonSerializer;
Expand Down Expand Up @@ -53,6 +54,7 @@ public class BackupServletV2 {
private final IMetaProxy metaProxy;
private final Provider<AbstractBackupPath> pathProvider;
private final BackupV2Service backupService;
private final BackupNotificationMgr backupNotificationMgr;
private static final String REST_SUCCESS = "[\"ok\"]";

@Inject
Expand All @@ -65,7 +67,8 @@ public BackupServletV2(
IBackupFileSystem fileSystem,
@Named("v2") IMetaProxy metaV2Proxy,
Provider<AbstractBackupPath> pathProvider,
BackupV2Service backupService) {
BackupV2Service backupService,
BackupNotificationMgr backupNotificationMgr) {
this.backupStatusMgr = backupStatusMgr;
this.backupVerification = backupVerification;
this.snapshotMetaService = snapshotMetaService;
Expand All @@ -74,6 +77,7 @@ public BackupServletV2(
this.metaProxy = metaV2Proxy;
this.pathProvider = pathProvider;
this.backupService = backupService;
this.backupNotificationMgr = backupNotificationMgr;
}

@GET
Expand Down Expand Up @@ -131,6 +135,17 @@ public Response validateV2SnapshotByDate(
.build();
}

// Send notification for any verified backups. This is useful in one-off backup consumption
// by downward dependencies.
// Side-effect: It may send notification for already verified snapshot i.e. duplicate
// message may be sent.
logger.info(
"Sending {} message for backup: {}",
AbstractBackupPath.BackupFileType.SNAPSHOT_VERIFIED,
result.get().remotePath);

backupNotificationMgr.notify(result.get().remotePath, result.get().snapshotInstant);

return Response.ok(result.get().toString()).build();
}

Expand Down