From c0c546eb4ec9613da826648323e6cd01e89bfc70 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 25 Jun 2017 21:16:08 +0200 Subject: [PATCH] btrbk: stats command: show "correlated" status instead of "orphaned" (inverse logic which caused a lot of confusion) --- ChangeLog | 1 + btrbk | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 513abd2..6f42d21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ btrbk-current * Bugfix: accept "no" for "transaction_log", "transaction_syslog" and "lockfile" configuration options. * Show "up-to-date" status for backups in "stats" command. + * Show "correlated" status instead of "orphaned" in "stats" command. btrbk-0.25.0 diff --git a/btrbk b/btrbk index b35a0a9..590c230 100755 --- a/btrbk +++ b/btrbk @@ -4737,6 +4737,7 @@ MAIN: my @stats_data; my $stats_snapshots_total = 0; my $stats_backups_total = 0; + my $stats_backups_total_correlated = 0; my $stats_backups_total_incomplete = 0; my $stats_backups_total_orphaned = 0; if($action_resolve eq "snapshots") @@ -4789,7 +4790,7 @@ MAIN: $stats_snapshots_total += scalar(@snapshot_children); # NOTE: this adds ALL snaphot children under $sroot (not only the ones created by btrbk!) foreach my $droot (vinfo_subsection($svol, 'target')) { - my $stats_received = 0; + my $stats_correlated = 0; my $stats_orphaned = 0; my $stats_incomplete = 0; my $target_up_to_date = 0; @@ -4810,7 +4811,7 @@ MAIN: } } if($parent_snapshot) { - $stats_received++; + $stats_correlated++; my $up_to_date = ($parent_snapshot->{node}{cgen} == $svol->{node}{gen}); push @data, { type => "received", vinfo_prefixed_keys("target", $target_vol), @@ -4837,13 +4838,14 @@ MAIN: } } } - my $stats_total = $stats_received + $stats_incomplete + $stats_orphaned; + my $stats_total = $stats_correlated + $stats_incomplete + $stats_orphaned; $stats_backups_total += $stats_total; + $stats_backups_total_correlated += $stats_correlated; $stats_backups_total_incomplete += $stats_incomplete; $stats_backups_total_orphaned += $stats_orphaned; my @stats_detail; push @stats_detail, "up-to-date" if($target_up_to_date); - push @stats_detail, "$stats_orphaned orphaned" if($stats_orphaned); + push @stats_detail, "$stats_correlated correlated" if($stats_correlated); push @stats_detail, "$stats_incomplete incomplete" if($stats_incomplete); my $stats_detail_print = join(', ', @stats_detail); $stats_detail_print = " ($stats_detail_print)" if($stats_detail_print); @@ -4893,7 +4895,7 @@ MAIN: time => $start_time, legend => [ "up-to-date: latest snapshot/backup is up to date with source subvolume", - "orphaned : parent snapshot was deleted (by snapshot_preserve policy)", + "correlated: corresponding (reveived-from) source snapshot is present", ], ); @@ -4901,7 +4903,7 @@ MAIN: print "\n"; my $stats_filter = $config->{CMDLINE_FILTER_LIST} ? join("; ", @{$config->{CMDLINE_FILTER_LIST}}) : ""; my @stats_total_detail; - push @stats_total_detail, "$stats_backups_total_orphaned orphaned" if($stats_backups_total_orphaned); + push @stats_total_detail, "$stats_backups_total_correlated correlated" if($stats_backups_total_correlated); push @stats_total_detail, "$stats_backups_total_incomplete incomplete" if($stats_backups_total_incomplete); my $stats_total_detail_print = join(', ', @stats_total_detail); $stats_total_detail_print = " ($stats_total_detail_print)" if($stats_total_detail_print);