btrbk: bugfix: do not keep latest common snapshot for "incremental no"

There is no reason to keep the latest common source snapshot if
"incremental no" is configured (see #252).
pull/208/merge
Axel Burri 2018-10-02 17:22:57 +02:00
parent 1862bc16d3
commit 3528927ea6
2 changed files with 14 additions and 10 deletions

View File

@ -11,6 +11,8 @@ btrbk-0.27.0-dev
* Bugfix: add "btrfs filesystem usage" backend mapping (close #222).
* Bugfix: do not fail (exitcode=10) if targets are not accessible on
"btrfs snapshot --preserve".
* Bugfix: if "incremental no" is configured on target, do not keep
latest common snapshot.
* Enhance internal data structures:
- Allow snapshot_dir to be a mountpoint.
- Search complete target tree for correlated subvolumes.

22
btrbk
View File

@ -5990,17 +5990,19 @@ MAIN:
next;
}
# always preserve latest common snapshot/backup pair
foreach my $child (@snapshot_children) {
my @receive_targets = get_receive_targets($droot, $child, exact => 1);
if(scalar(@receive_targets)) {
DEBUG "Force preserve for latest common snapshot: $child->{PRINT}";
$child->{node}{FORCE_PRESERVE} = 'preserve forced: latest common snapshot';
foreach(@receive_targets) {
DEBUG "Force preserve for latest common target: $_->{PRINT}";
$_->{node}{FORCE_PRESERVE} = 'preserve forced: latest common target';
# preserve latest common snapshot/backup (for incremental targets)
if(config_key($droot, "incremental")) {
foreach my $child (@snapshot_children) {
my @receive_targets = get_receive_targets($droot, $child, exact => 1);
if(scalar(@receive_targets)) {
DEBUG "Force preserve for latest common snapshot: $child->{PRINT}";
$child->{node}{FORCE_PRESERVE} = 'preserve forced: latest common snapshot';
foreach(@receive_targets) {
DEBUG "Force preserve for latest common target: $_->{PRINT}";
$_->{node}{FORCE_PRESERVE} = 'preserve forced: latest common target';
}
last;
}
last;
}
}