mirror of
https://github.com/schoebel/mars
synced 2025-01-27 09:44:41 +00:00
marsadm: fix split brain detection
This commit is contained in:
parent
0d579d48ba
commit
003ba4136f
@ -1434,22 +1434,20 @@ sub detect_splitbrain {
|
||||
# dynamic programming
|
||||
return $detected_splits{$res} if defined($detected_splits{$res});
|
||||
my $basedir = "$mars/resource-$res";
|
||||
my $retry = 2;
|
||||
my $ok = 1;
|
||||
my @list = glob("$mars/resource-$res/replay-*");
|
||||
my @hosts = map { $_ =~ s:.*/replay-::; $_ } @list;
|
||||
AGAIN:
|
||||
foreach my $host1 (@hosts) {
|
||||
foreach my $host2 (@hosts) {
|
||||
next if $host1 ge $host2;
|
||||
my ($point, $split, $size1, $size2) = get_common_ancestor($basedir, $host1, $host2);
|
||||
if ($split) {
|
||||
my ($point, $split, $size1, $size2);
|
||||
for (my $retry = 2; $retry > 0; $retry--) {
|
||||
($point, $split, $size1, $size2) = get_common_ancestor($basedir, $host1, $host2);
|
||||
last if !$split;
|
||||
# Workaround races.
|
||||
if ($retry > 0) {
|
||||
$retry--;
|
||||
sleep(2);
|
||||
next AGAIN;
|
||||
}
|
||||
sleep(0);
|
||||
}
|
||||
if ($split) {
|
||||
$ok = 0;
|
||||
if ($do_report) {
|
||||
my $age = "";
|
||||
|
Loading…
Reference in New Issue
Block a user