BUG-6937: Add ReachableMember case to Gossiper 79/51079/3
authorTomas Cere <tcere@cisco.com>
Thu, 26 Jan 2017 17:36:33 +0000 (18:36 +0100)
committerTomas Cere <tcere@cisco.com>
Fri, 27 Jan 2017 09:53:56 +0000 (10:53 +0100)
In case we detect a member down event we remove that member's
address from the whitelist, leading to further gossips being
ignored.

Subscribe to ReachableMember event to receive notifications
when the cluster heals, so we propagate re-add the member
back to the whitelist.

Change-Id: Id6b366edfa2be89e1a15225d2cad786bbf552129
Signed-off-by: Tomas Cere <tcere@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/Gossiper.java

index d26bda1..04c767e 100644 (file)
@@ -108,6 +108,7 @@ public class Gossiper extends AbstractUntypedActorWithMetering {
             cluster.subscribe(getSelf(),
                     ClusterEvent.initialStateAsEvents(),
                     ClusterEvent.MemberEvent.class,
+                    ClusterEvent.ReachableMember.class,
                     ClusterEvent.UnreachableMember.class);
         }
 
@@ -149,7 +150,10 @@ public class Gossiper extends AbstractUntypedActorWithMetering {
             // comparing the GossipStatus message with its local versions.
             receiveGossip((GossipEnvelope) message);
         } else if (message instanceof ClusterEvent.MemberUp) {
-            receiveMemberUp(((ClusterEvent.MemberUp) message).member());
+            receiveMemberUpOrReachable(((ClusterEvent.MemberUp) message).member());
+
+        } else if (message instanceof ClusterEvent.ReachableMember) {
+            receiveMemberUpOrReachable(((ClusterEvent.ReachableMember) message).member());
 
         } else if (message instanceof ClusterEvent.MemberRemoved) {
             receiveMemberRemoveOrUnreachable(((ClusterEvent.MemberRemoved) message).member());
@@ -183,10 +187,11 @@ public class Gossiper extends AbstractUntypedActorWithMetering {
      *
      * @param member the member to add
      */
-    void receiveMemberUp(Member member) {
+    void receiveMemberUpOrReachable(final Member member) {
 
         if (selfAddress.equals(member.address())) {
-            return; //ignore up notification for self
+            //ignore up notification for self
+            return;
         }
 
         if (!clusterMembers.contains(member.address())) {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.