BUG-8392 RpcRegistry has it's buckets populated by unreachable nodes 84/56784/3
authorTomas Cere <tcere@cisco.com>
Wed, 10 May 2017 12:04:37 +0000 (14:04 +0200)
committerTomas Cere <tcere@cisco.com>
Wed, 10 May 2017 13:06:02 +0000 (13:06 +0000)
In a situation when a member(f.ex member2) is isolated and the rpc registrations
are removed from the node(member1) we can still have our bucket store populated
by buckets from the remaining node(member-3) which might not have received
the memberUnreachable message yet leadig to stale routing of an rpc to
member-2.
This patch adds bucket filtering based on the currently present peers
so that we only accept Buckets that we can see.

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

index f24ca33..275200f 100644 (file)
@@ -20,6 +20,7 @@ import akka.cluster.Member;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Verify;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Verify;
+import com.google.common.collect.Maps;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -175,6 +176,8 @@ public class Gossiper extends AbstractUntypedActorWithMetering {
      * @param member who went down
      */
     private void receiveMemberRemoveOrUnreachable(final Member member) {
      * @param member who went down
      */
     private void receiveMemberRemoveOrUnreachable(final Member member) {
+        LOG.debug("Received memberDown or Unreachable: {}", member);
+
         //if its self, then stop itself
         if (selfAddress.equals(member.address())) {
             getContext().stop(getSelf());
         //if its self, then stop itself
         if (selfAddress.equals(member.address())) {
             getContext().stop(getSelf());
@@ -205,6 +208,8 @@ public class Gossiper extends AbstractUntypedActorWithMetering {
      * @param member the member to add
      */
     private void receiveMemberUpOrReachable(final Member member) {
      * @param member the member to add
      */
     private void receiveMemberUpOrReachable(final Member member) {
+        LOG.debug("Received memberUp or reachable: {}", member);
+
         //ignore up notification for self
         if (selfAddress.equals(member.address())) {
             return;
         //ignore up notification for self
         if (selfAddress.equals(member.address())) {
             return;
@@ -329,7 +334,8 @@ public class Gossiper extends AbstractUntypedActorWithMetering {
      */
     @VisibleForTesting
     void updateRemoteBuckets(final Map<Address, ? extends Bucket<?>> buckets) {
      */
     @VisibleForTesting
     void updateRemoteBuckets(final Map<Address, ? extends Bucket<?>> buckets) {
-        bucketStore.updateRemoteBuckets(buckets);
+        // filter this so we only handle buckets for known peers
+        bucketStore.updateRemoteBuckets(Maps.filterKeys(buckets, peers::containsKey));
     }
 
     /**
     }
 
     /**

©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.