mirror of https://github.com/digint/btrbk
btrbk: fix regression: correctly handle previously received subvolumes in get_latest_common()
regression from: 8819c67502
pull/88/head
parent
7bb18050f8
commit
e6d46e8a02
15
btrbk
15
btrbk
|
@ -1487,13 +1487,12 @@ sub get_latest_common($$$;$)
|
|||
my $debug_src = $svol->{URL};
|
||||
$debug_src .= "#" . $threshold_gen if($threshold_gen);
|
||||
|
||||
# prefer latest received subvolume as latest common
|
||||
# keep track of already received subvolumes
|
||||
my %receive_target_present;
|
||||
if($droot->{SUBVOL_RECEIVED}) {
|
||||
foreach(reverse @{$droot->{SUBVOL_RECEIVED}}) {
|
||||
TRACE "get_latest_common: checking previously received subvolume: $_->{source}->{PRINT}";
|
||||
foreach(@{$droot->{SUBVOL_RECEIVED}}) {
|
||||
next if($_->{ERROR});
|
||||
DEBUG("Latest common subvolumes for: $debug_src: src=$_->{source}->{PRINT} target=$_->{received_subvolume}->{PRINT} (previously received)");
|
||||
return ($_->{source}, $_->{received_subvolume});
|
||||
$receive_target_present{$_->{source}->{node}{uuid}} = $_->{received_subvolume};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1505,6 +1504,12 @@ sub get_latest_common($$$;$)
|
|||
next;
|
||||
}
|
||||
|
||||
if(my $received_subvol = $receive_target_present{$child->{node}{uuid}}) {
|
||||
# subvolume has been previously received
|
||||
DEBUG("Latest common subvolumes for: $debug_src: src=$child->{PRINT} target=$received_subvol->{PRINT} (previously received)");
|
||||
return ($child, $received_subvol);
|
||||
}
|
||||
|
||||
foreach (get_receive_targets($droot, $child)) {
|
||||
DEBUG("Latest common subvolumes for: $debug_src: src=$child->{PRINT} target=$_->{PRINT}");
|
||||
return ($child, $_);
|
||||
|
|
Loading…
Reference in New Issue