marsadm: report likely false positive split-brain

This commit is contained in:
Thomas Schoebel-Theuer 2022-02-16 11:54:38 +01:00 committed by Thomas Schoebel-Theuer
parent 3d74ea737b
commit 2f75f0e218

View File

@ -3686,6 +3686,8 @@ sub detect_splitbrain {
my %alive_host_stamps;
my %involved_logfiles;
my %involved_hosts;
my $is_likely_false_positive = 0;
my $i_am_primary = 0;
my @list = lamport_glob("$mars/resource-$res/replay-*");
my @hosts = map { $_ =~ s:.*/replay-::; $_ } @list;
foreach my $host1 (@hosts) {
@ -3736,6 +3738,19 @@ sub detect_splitbrain {
($point, $split, $size2, $size1) = get_common_ancestor($basedir, $host2, $host1);
goto re_check;
}
} elsif ($host1 eq $real_host || $host2 eq $real_host) {
# try to filter out false positives
foreach my $other ($host1, $host2) {
my $lnk = "$mars/resource-$res/actual-$other/is-primary";
my $is_primary = get_link($lnk, 2);
if ($is_primary && is_link_recent($lnk, $window)) {
if ($other eq $real_host) {
$i_am_primary++;
} else {
$is_likely_false_positive++;
}
}
}
}
}
}
@ -3777,6 +3792,14 @@ sub detect_splitbrain {
} elsif (!is_recent($stamp, $window)) {
$txt .= " interrupted ~" . seconds2human(mars_time() - $stamp);
}
if ($peer eq $real_host) {
if ($i_am_primary) {
lhint " host$nr = '$peer'$txt, my PRIMARY logfile is always UPTODATE by definition.\n";
next;
} elsif ($is_likely_false_positive) {
lhint " the following warning MAY be a FALSE POSITIVE (but I cannot determine the truth over network)\n";
}
}
if (defined($size) && $size > 0) {
lwarn " host$nr = '$peer'$txt logfile_amount='$size' (" . number2human($size) . ")\n";
} else {