Fix bug when comparing snapshot and bookmark creation times

This commit fixes a bug introduced in commit
522bdecd53

Creation times of snapshots have a three digit suffix while bookmark
creation times do not. This leads to the comparison always being true.
This commit is contained in:
0xFelix 2021-03-14 17:46:16 +01:00
parent 6b9fca6a76
commit a669ba11ca
1 changed files with 3 additions and 5 deletions

View File

@ -699,11 +699,9 @@ sub syncdataset {
# do an replication to it and replicate as always from oldest to newest
# because bookmark sends doesn't support intermediates directly
foreach my $snap ( sort { sortsnapshots(\%snaps, $a, $b, 'source') } keys %{ $snaps{'source'} }) {
my $comparisonkey = 'creation';
if (defined $snaps{'source'}{$snap}{'createtxg'} && defined $bookmark{'createtxg'}) {
$comparisonkey = 'createtxg';
}
if ($snaps{'source'}{$snap}{$comparisonkey} >= $bookmark{$comparisonkey}) {
my $comparetxg = defined $snaps{'source'}{$snap}{'createtxg'} && defined $bookmark{'createtxg'};
if (($comparetxg && $snaps{'source'}{$snap}{'createtxg'} >= $bookmark{'createtxg'}) ||
substr($snaps{'source'}{$snap}{'creation'}, 0, -3) >= $bookmark{'creation'}) {
$nextsnapshot = $snap;
last;
}