[PATCH] cpg: Enhance downlist selection algorithm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let's say we have 2 nodes:
- node 2 is paused
- node 1 create membership (one node)
- node 2 is unpaused

Result is that node 1 downlist is selected, so it means that from node 2
point of view, node 1 was never down.

Patch solves situation by adding additional check for largest previous
membership.

So current tests are:
1) largest (previous #nodes - #nodes know to have left)
2) (then) largest previous membership
3) (and last as a tie-breaker) node with smallest nodeid

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/cpg.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/exec/cpg.c b/exec/cpg.c
index 8b883f8..47743a5 100644
--- a/exec/cpg.c
+++ b/exec/cpg.c
@@ -811,16 +811,17 @@ static struct downlist_msg* downlist_master_choose (void)
 		best_members = best->old_members - best->left_nodes;
 		cmp_members = cmp->old_members - cmp->left_nodes;
 
-		if (cmp_members < best_members) {
-			continue;
-		}
-		else if (cmp_members > best_members) {
-			best = cmp;
-		}
-		else if (cmp->sender_nodeid < best->sender_nodeid) {
+		if (cmp_members > best_members) {
 			best = cmp;
+		} else if (cmp_members == best_members) {
+			if (cmp->old_members > best->old_members) {
+				best = cmp;
+			} else if (cmp->old_members == best->old_members) {
+				if (cmp->sender_nodeid < best->sender_nodeid) {
+					best = cmp;
+				}
+			}
 		}
-
 	}
 
 	assert (best != NULL);
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux