From 6c0aa577ee70b3868ad1cb513e5b3c3360ad0924 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 11 Sep 2018 08:27:18 +0200 Subject: [PATCH] marsadm: workaround split brain detection races --- userspace/marsadm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/userspace/marsadm b/userspace/marsadm index 59f22d80..bf1e526f 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -1434,14 +1434,22 @@ 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) { + # Workaround races. + if ($retry > 0) { + $retry--; + sleep(2); + next AGAIN; + } $ok = 0; if ($do_report) { my $age = "";