btrbk: correctly log statistics of resumed subvolumes

pull/30/head
Axel Burri 2015-05-15 17:32:30 +02:00
parent 2d445a84cb
commit b0b2bb99f1
1 changed files with 6 additions and 4 deletions

10
btrbk
View File

@ -1805,7 +1805,8 @@ MAIN:
{ {
INFO "Checking for missing backups of subvolume \"$svol->{PRINT}\" in: $droot->{PRINT}/"; INFO "Checking for missing backups of subvolume \"$svol->{PRINT}\" in: $droot->{PRINT}/";
my @schedule; my @schedule;
my $found_missing = 0; my $resume_total = 0;
my $resume_success = 0;
foreach my $child (sort { $a->{gen} <=> $b->{gen} } get_snapshot_children($sroot, $svol)) foreach my $child (sort { $a->{gen} <=> $b->{gen} } get_snapshot_children($sroot, $svol))
{ {
@ -1846,10 +1847,10 @@ MAIN:
preserve_monthly => config_key($config_target, "target_preserve_monthly"), preserve_monthly => config_key($config_target, "target_preserve_monthly"),
); );
my @resume = grep defined, @$preserve; # remove entries with no value from list (target subvolumes) my @resume = grep defined, @$preserve; # remove entries with no value from list (target subvolumes)
$resume_total = scalar @resume;
foreach my $child (sort { $a->{gen} <=> $b->{gen} } @resume) { foreach my $child (sort { $a->{gen} <=> $b->{gen} } @resume) {
INFO "Resuming subvolume backup (send-receive) for: $child->{PRINT}"; INFO "Resuming subvolume backup (send-receive) for: $child->{PRINT}";
$found_missing++;
my ($latest_common_src, $latest_common_target) = get_latest_common($sroot, $svol, $droot, $child->{gen}); my ($latest_common_src, $latest_common_target) = get_latest_common($sroot, $svol, $droot, $child->{gen});
if(macro_send_receive($config_target, if(macro_send_receive($config_target,
snapshot => $child, snapshot => $child,
@ -1860,6 +1861,7 @@ MAIN:
{ {
# tag the source snapshot, so that get_latest_common() above can make use of the newly received subvolume # tag the source snapshot, so that get_latest_common() above can make use of the newly received subvolume
$child->{RECEIVE_TARGET_PRESENT} = $droot->{URL}; $child->{RECEIVE_TARGET_PRESENT} = $droot->{URL};
$resume_success++;
} }
else { else {
# note: ABORTED flag is already set by macro_send_receive() # note: ABORTED flag is already set by macro_send_receive()
@ -1869,8 +1871,8 @@ MAIN:
} }
} }
if($found_missing) { if($resume_total) {
INFO "Resumed $found_missing backups"; INFO "Resumed $resume_success/$resume_total missing backups";
} else { } else {
INFO "No missing backups found"; INFO "No missing backups found";
} }