Compare commits

..

5 Commits

Author SHA1 Message Date
Kenny Phelps-McKeown eab257db1f
Merge b50e55c17a into 1ae8f26e82 2026-02-18 22:00:39 +01:00
Jim Salter 1ae8f26e82
avoid bug with snapshots named 0
Updated error handling to check for empty string instead of false for snapshot retrieval.
2026-02-18 00:19:37 -05:00
Jim Salter d9fe50b564
Merge pull request #1074 from ifazk/create-bookmark-last-snapshot
Fix bookmark last snapshot sync early exit
2026-02-17 13:04:37 -05:00
Jim Salter d8ff385691
Change comparison from '==' to 'ne' for error checks
Zpool status reports error counts with unit suffixes after the first 999 errors in any given column; as originally written, the monitor-health plugin used strictly numeric comparison checks which would error out when encountering a value like "1.09K" for checksum errors.
2026-02-17 11:53:42 -05:00
Ifaz Kabir 89d3cbcda3 Fix bookmark last snapshot sync early exit 2026-02-17 10:37:28 -05:00
2 changed files with 12 additions and 15 deletions

6
sanoid
View File

@ -1380,9 +1380,9 @@ sub check_zpool() {
# check for io/checksum errors
my @vdeverr = ();
if ($read != 0) { push @vdeverr, "read" };
if ($write != 0) { push @vdeverr, "write" };
if ($cksum != 0) { push @vdeverr, "cksum" };
if ($read ne 0) { push @vdeverr, "read" };
if ($write ne 0) { push @vdeverr, "write" };
if ($cksum ne 0) { push @vdeverr, "cksum" };
if (scalar @vdeverr) {
$dmge=$dmge . "(" . $dev . ":" . join(", ", @vdeverr) . " errors) ";

21
syncoid
View File

@ -431,7 +431,7 @@ sub syncdataset {
if (!defined $args{'no-sync-snap'} && !defined $skipsnapshot) {
# create a new syncoid snapshot on the source filesystem.
$newsyncsnap = newsyncsnap($sourcehost,$sourcefs,$sourceisroot);
if (!$newsyncsnap) {
if ($newsyncsnap eq '') {
# we already whined about the error
return 0;
}
@ -439,7 +439,7 @@ sub syncdataset {
# --include-snaps
if (!snapisincluded($newsyncsnap)) {
$newsyncsnap = getnewestsnapshot($sourcehost,$sourcefs,$sourceisroot);
if ($newsyncsnap eq 0) {
if ($newsyncsnap eq '') {
writelog('WARN', "CRITICAL: no snapshots exist on source $sourcefs, and you asked for --no-sync-snap.");
if ($exitcode < 1) { $exitcode = 1; }
return 0;
@ -448,7 +448,7 @@ sub syncdataset {
} else {
# we don't want sync snapshots created, so use the newest snapshot we can find.
$newsyncsnap = getnewestsnapshot($sourcehost,$sourcefs,$sourceisroot);
if ($newsyncsnap eq 0) {
if ($newsyncsnap eq '') {
writelog('WARN', "CRITICAL: no snapshots exist on source $sourcefs, and you asked for --no-sync-snap.");
if ($exitcode < 1) { $exitcode = 1; }
return 0;
@ -476,13 +476,13 @@ sub syncdataset {
writelog('DEBUG', "target $targetfs does not exist, and --no-stream selected. Finding newest available snapshot on source $sourcefs ...");
}
my $oldestsnap = getoldestsnapshot(\%snaps);
if (! $oldestsnap) {
if ($oldestsnap eq '') {
if (defined ($args{'no-sync-snap'}) ) {
# we already whined about the missing snapshots
return 0;
}
# getoldestsnapshot() returned false, so use new sync snapshot
# getoldestsnapshot() returned null, so use new sync snapshot
writelog('DEBUG', "getoldestsnapshot() returned false, so using $newsyncsnap.");
$oldestsnap = $newsyncsnap;
}
@ -726,11 +726,8 @@ sub syncdataset {
# do a normal replication if bookmarks aren't used or if previous
# bookmark replication was only done to the next oldest snapshot
if (!$bookmark || $nextsnapshot) {
if ($matchingsnap eq $newsyncsnap) {
# edge case: bookmark replication used the latest snapshot
return 0;
}
# edge case: skip repilcation if bookmark replication used the latest snapshot
if ((!$bookmark || $nextsnapshot) && !($matchingsnap eq $newsyncsnap)) {
($exit, $stdout) = syncincremental($sourcehost, $sourcefs, $targethost, $targetfs, $matchingsnap, $newsyncsnap, defined($args{'no-stream'}));
@ -1541,7 +1538,7 @@ sub getoldestsnapshot {
# well, actually we set --no-sync-snap, so no we *didn't* already make one. Whoops.
writelog('CRITICAL', "--no-sync-snap is set, and getoldestsnapshot() could not find any snapshots on source!");
}
return 0;
return '';
}
sub getnewestsnapshot {
@ -1563,7 +1560,7 @@ sub getnewestsnapshot {
writelog('WARN', "--no-sync-snap is set, and getnewestsnapshot() could not find any snapshots on source for current dataset. Continuing.");
if ($exitcode < 2) { $exitcode = 2; }
}
return 0;
return '';
}
sub buildsynccmd {