Skip to content

Commit

Permalink
Fix snapshot location regression in SNS messages. (#1055)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattl-netflix committed May 5, 2023
1 parent e8aeded commit 2657e7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -28,6 +28,8 @@
import com.netflix.priam.scheduler.TaskTimer;
import com.netflix.priam.utils.DateUtil;
import com.netflix.priam.utils.DateUtil.DateRange;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
Expand Down Expand Up @@ -93,12 +95,17 @@ public void execute() throws Exception {
.filter(result -> result.getLastValidated().toInstant().isAfter(now))
.forEach(
result -> {
Path snapshotLocation = Paths.get(result.getSnapshotLocation());
String snapshotKey =
snapshotLocation
.subpath(1, snapshotLocation.getNameCount())
.toString();
logger.info(
"Sending {} message for backup: {}",
AbstractBackupPath.BackupFileType.SNAPSHOT_VERIFIED,
result.getSnapshotLocation());
snapshotKey);
backupNotificationMgr.notify(
result.getSnapshotLocation(), result.getStart().toInstant());
snapshotKey, result.getStart().toInstant());
});

if (verifiedBackups.isEmpty()) {
Expand Down
Expand Up @@ -191,6 +191,7 @@ private static BackupMetadata getRecentlyValidatedMetadata() {
new BackupMetadata(BackupVersion.SNAPSHOT_META_SERVICE, "12345", new Date());
backupMetadata.setLastValidated(
new Date(Instant.now().plus(1, ChronoUnit.HOURS).toEpochMilli()));
backupMetadata.setSnapshotLocation("bucket/path/to/file.db");
return backupMetadata;
}
}

0 comments on commit 2657e7e

Please sign in to comment.