marsadm: fix too strong race detection

This commit is contained in:
Thomas Schoebel-Theuer 2020-11-26 07:22:27 +01:00 committed by Thomas Schoebel-Theuer
parent beea145ec4
commit 94df66a3c1

View File

@ -3061,9 +3061,10 @@ sub log_purge_res {
my $replay = "$basedir/replay-$peer";
my $target = get_link($replay, 1);
next unless $target;
$situation{$replay} = $target;
lprint "found replay link '$replay' -> '$target'\n";
# only the logfile number is relevant, not the positions
$target =~ s/,.*//;
$situation{$replay} = $target;
$start_logs{$target}++;
$start_count++;
_mark_path_transitive($basedir, $target, $peer);
@ -3127,6 +3128,8 @@ sub log_purge_res {
foreach my $replay (sort keys(%situation)) {
my $old_situation = $situation{$replay};
my $target = get_link($replay, 1);
# only the logfile number is relevant, not the positions
$target =~ s/,.*//;
if (!$target || $target ne $old_situation) {
lwarn "Race on '$replay' -> '$target' instead of '$old_situation'\n";
$nr_races++;
@ -3135,6 +3138,7 @@ sub log_purge_res {
if ($nr_races) {
if ($max_retry-- > 0) {
lwarn "Restarting due to $nr_races races\n";
sleep(1);
goto retry;
}
ldie "Detected $nr_races, the situation is not stable\n";