mirror of https://github.com/schoebel/mars
marsadm: workaround split brain detection races
This commit is contained in:
parent
1616b620c7
commit
6c0aa577ee
|
@ -1434,14 +1434,22 @@ sub detect_splitbrain {
|
||||||
# dynamic programming
|
# dynamic programming
|
||||||
return $detected_splits{$res} if defined($detected_splits{$res});
|
return $detected_splits{$res} if defined($detected_splits{$res});
|
||||||
my $basedir = "$mars/resource-$res";
|
my $basedir = "$mars/resource-$res";
|
||||||
|
my $retry = 2;
|
||||||
my $ok = 1;
|
my $ok = 1;
|
||||||
my @list = glob("$mars/resource-$res/replay-*");
|
my @list = glob("$mars/resource-$res/replay-*");
|
||||||
my @hosts = map { $_ =~ s:.*/replay-::; $_ } @list;
|
my @hosts = map { $_ =~ s:.*/replay-::; $_ } @list;
|
||||||
|
AGAIN:
|
||||||
foreach my $host1 (@hosts) {
|
foreach my $host1 (@hosts) {
|
||||||
foreach my $host2 (@hosts) {
|
foreach my $host2 (@hosts) {
|
||||||
next if $host1 ge $host2;
|
next if $host1 ge $host2;
|
||||||
my ($point, $split, $size1, $size2) = get_common_ancestor($basedir, $host1, $host2);
|
my ($point, $split, $size1, $size2) = get_common_ancestor($basedir, $host1, $host2);
|
||||||
if ($split) {
|
if ($split) {
|
||||||
|
# Workaround races.
|
||||||
|
if ($retry > 0) {
|
||||||
|
$retry--;
|
||||||
|
sleep(2);
|
||||||
|
next AGAIN;
|
||||||
|
}
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
if ($do_report) {
|
if ($do_report) {
|
||||||
my $age = "";
|
my $age = "";
|
||||||
|
|
Loading…
Reference in New Issue