Skip to content

Commit

Permalink
fix(syncoid): regather $snaps on --delete-target-snapshots flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Fulton committed Apr 1, 2024
1 parent 91a960f commit 5797463
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions syncoid
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,16 @@ sub syncdataset {
# those that exist on the source. Remaining are the snapshots
# that are only on the target. Then sort by creation date, as
# to remove the oldest snapshots first.

# regather snapshots on source and target
%snaps = getsnaps('source',$sourcehost,$sourcefs,$sourceisroot);

if ($targetexists) {
my %targetsnaps = getsnaps('target',$targethost,$targetfs,$targetisroot);
my %sourcesnaps = %snaps;
%snaps = (%sourcesnaps, %targetsnaps);
}

my @to_delete = sort { $snaps{'target'}{$a}{'creation'}<=>$snaps{'target'}{$b}{'creation'} } grep {!exists $snaps{'source'}{$_}} keys %{ $snaps{'target'} };
while (@to_delete) {
# Create batch of snapshots to remove
Expand Down

0 comments on commit 5797463

Please sign in to comment.