diff --git a/CHANGELIST b/CHANGELIST index b033118..3e26389 100644 --- a/CHANGELIST +++ b/CHANGELIST @@ -1,3 +1,8 @@ +1.4.11 enhanced Syncoid to use zfs `guid` property rather than `creation` property to ensure snapshots on source + and target actually match. This immediately prevents conflicts due to timezone differences on source and target, + and also paves the way in the future for Syncoid to find matching snapshots even after `zfs rename` on source + or target. Thank you Github user @mailinglists35 for the idea! + 1.4.10 added --compress=pigz-fast and --compress=pigz-slow. On a Xeon E3-1231v3, pigz-fast is equivalent compression to --compress=gzip but with compressed throughput of 75.2 MiB/s instead of 18.1 MiB/s. pigz-slow is around 5% better compression than compress=gzip with roughly equivalent compressed throughput. Note that pigz-fast produces diff --git a/VERSION b/VERSION index ac9f79c..079d7f6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.10 +1.4.11 diff --git a/sanoid b/sanoid index dfa833f..ac9d769 100755 --- a/sanoid +++ b/sanoid @@ -4,7 +4,7 @@ # from http://www.gnu.org/licenses/gpl-3.0.html on 2014-11-17. A copy should also be available in this # project's Git repository at https://github.com/jimsalterjrs/sanoid/blob/master/LICENSE. -my $version = '1.4.10'; +my $version = '1.4.11'; use strict; use Config::IniFiles; # read samba-style conf file diff --git a/syncoid b/syncoid index 6f2b36a..1b16c66 100755 --- a/syncoid +++ b/syncoid @@ -4,7 +4,7 @@ # from http://www.gnu.org/licenses/gpl-3.0.html on 2014-11-17. A copy should also be available in this # project's Git repository at https://github.com/jimsalterjrs/sanoid/blob/master/LICENSE. -my $version = '1.4.10'; +my $version = '1.4.11'; use strict; use warnings; @@ -616,7 +616,7 @@ sub readablebytes { sub getoldestsnapshot { my $snaps = shift; - foreach my $snap ( sort { $snaps{'source'}{$a}{'ctime'}<=>$snaps{'source'}{$b}{'ctime'} } keys %{ $snaps{'source'} }) { + foreach my $snap ( sort { $snaps{'source'}{$a}{'guid'}<=>$snaps{'source'}{$b}{'guid'} } keys %{ $snaps{'source'} }) { # return on first snap found - it's the oldest return $snap; } @@ -627,7 +627,7 @@ sub getoldestsnapshot { sub getnewestsnapshot { my $snaps = shift; - foreach my $snap ( sort { $snaps{'source'}{$b}{'ctime'}<=>$snaps{'source'}{$a}{'ctime'} } keys %{ $snaps{'source'} }) { + foreach my $snap ( sort { $snaps{'source'}{$b}{'guid'}<=>$snaps{'source'}{$a}{'guid'} } keys %{ $snaps{'source'} }) { # return on first snap found - it's the newest print "NEWEST SNAPSHOT: $snap\n"; return $snap; @@ -755,9 +755,9 @@ sub pruneoldsyncsnaps { sub getmatchingsnapshot { my ($targetsize, $snaps) = shift; - foreach my $snap ( sort { $snaps{'source'}{$b}{'ctime'}<=>$snaps{'source'}{$a}{'ctime'} } keys %{ $snaps{'source'} }) { - if (defined $snaps{'target'}{$snap}{'ctime'}) { - if ($snaps{'source'}{$snap}{'ctime'} == $snaps{'target'}{$snap}{'ctime'}) { + foreach my $snap ( sort { $snaps{'source'}{$b}{'guid'}<=>$snaps{'source'}{$a}{'guid'} } keys %{ $snaps{'source'} }) { + if (defined $snaps{'target'}{$snap}{'guid'}) { + if ($snaps{'source'}{$snap}{'guid'} == $snaps{'target'}{$snap}{'guid'}) { return $snap; } } @@ -852,7 +852,7 @@ sub getsnaps() { if ($rhost ne '') { $rhost = "$sshcmd $rhost"; } - my $getsnapcmd = "$rhost $mysudocmd $zfscmd get -Hpd 1 -t snapshot creation $fs |"; + my $getsnapcmd = "$rhost $mysudocmd $zfscmd get -Hpd 1 -t snapshot guid $fs |"; if ($debug) { print "DEBUG: getting list of snapshots on $fs using $getsnapcmd...\n"; } open FH, $getsnapcmd; my @rawsnaps = ; @@ -862,11 +862,11 @@ sub getsnaps() { # only import snaps from the specified filesystem if ($line =~ /$fs\@/) { chomp $line; - my $ctime = $line; - $ctime =~ s/^.*\screation\s*(\d*).*/$1/; + my $guid = $line; + $guid =~ s/^.*\sguid\s*(\d*).*/$1/; my $snap = $line; - $snap =~ s/^\S*\@(\S*)\s*creation.*$/$1/; - $snaps{$type}{$snap}{'ctime'}=$ctime; + $snap =~ s/^\S*\@(\S*)\s*guid.*$/$1/; + $snaps{$type}{$snap}{'guid'}=$guid; } }