From 1b4805464ac28f5001a79bb9eb1c1ee14d3cebe1 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Thu, 2 Oct 2014 10:23:43 +0200 Subject: [PATCH] marsadm: workaround concept bug in _get_actual_primary(), deprecate it The conceptual bug was leading to systematic false-positive failures in the old test_suite. These failures were depeding on the _names_ of the involved hosts: just run it on a pair of differently named hosts following different naming conventions, and 50 out of 90 testcases were failing false-positively. --- userspace/marsadm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/userspace/marsadm b/userspace/marsadm index 89c433b1..494484d3 100755 --- a/userspace/marsadm +++ b/userspace/marsadm @@ -920,11 +920,26 @@ sub get_size { return $arg; } +# DEPRECATED +# +# TST NOTE: avoid calling this function. As such it is conceptually wrong, +# because during split-brain situations, there exists a _set_ of non-unique +# primaries. I want to remove this function, but I currently can't because +# other internal software at 1&1 is depending on it. + # # Get actual primary node from links below actual-*/ subdirs # sub _get_actual_primary { my ($res) = @_; + # TST: Presence of local device takes precedence over anything else. + # This tries to workaround the most important special case of + # split-brain situations, but cannot fix the problem exhaustively. + llog "DEPRECATED: you are trying to uniquely identify an actual primary hostname (as seen from host $host resource $res), but this is conceptually wrong because in split-brain situations there may exist multiple ones. Use view-is-primary instead. That would be safe.\n"; + my $name = get_link("$mars/resource-$res/device-$real_host", 1); + my $dev = "/dev/mars/$name"; + return $real_host if -b $dev; + # The following old code is CONCEPTUALLY WRONG for split-brain situations (see NOTE above) my @primary_links = glob("$mars/resource-$res/actual-*/is-primary"); my $primary; foreach my $link (@primary_links) { @@ -2484,6 +2499,7 @@ sub eval_fn { my $op = $1; my $primary; if ($op eq "actual") { + lwarn "DEPRECATED: you are trying to uniquely identify an actual primary hostname, but this is conceptually wrong because in split-brain situations there may exist multiple ones. Use view-is-primary instead. That would be safe.\n"; $primary = _get_actual_primary($$env{"res"}); } else { $primary = _get_designated_primary($$env{"res"});