From f89372967f8975e6cf0e5bfbf8052186ad4133e0 Mon Sep 17 00:00:00 2001 From: Adam Fulton Date: Mon, 1 Apr 2024 11:53:45 -0500 Subject: [PATCH 1/2] fix(syncoid): regather $snaps on --delete-target-snapshots flag --- syncoid | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/syncoid b/syncoid index 61814d2..ea067b7 100755 --- a/syncoid +++ b/syncoid @@ -865,6 +865,16 @@ sub syncdataset { # those that exist on the source. Remaining are the snapshots # that are only on the target. Then sort 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 { sortsnapshots(\%snaps, $a, $b) } grep {!exists $snaps{'source'}{$_}} keys %{ $snaps{'target'} }; while (@to_delete) { # Create batch of snapshots to remove From d08b2882b7255ba630f5d338936d411a3d56e44c Mon Sep 17 00:00:00 2001 From: Adam Fulton Date: Mon, 1 Apr 2024 13:16:16 -0500 Subject: [PATCH 2/2] finish rebase to master --- syncoid | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/syncoid b/syncoid index ea067b7..cb18897 100755 --- a/syncoid +++ b/syncoid @@ -867,13 +867,13 @@ sub syncdataset { # snapshots first. # regather snapshots on source and target - %snaps = getsnaps('source',$sourcehost,$sourcefs,$sourceisroot); + %snaps = getsnaps('source',$sourcehost,$sourcefs,$sourceisroot,0); - if ($targetexists) { - my %targetsnaps = getsnaps('target',$targethost,$targetfs,$targetisroot); - my %sourcesnaps = %snaps; - %snaps = (%sourcesnaps, %targetsnaps); - } + if ($targetexists) { + my %targetsnaps = getsnaps('target',$targethost,$targetfs,$targetisroot,0); + my %sourcesnaps = %snaps; + %snaps = (%sourcesnaps, %targetsnaps); + } my @to_delete = sort { sortsnapshots(\%snaps, $a, $b) } grep {!exists $snaps{'source'}{$_}} keys %{ $snaps{'target'} }; while (@to_delete) {