geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [22/23] incubator-geode git commit: GEODE-1544: Fail to initiate final check when network partition occurs
Date Thu, 16 Jun 2016 17:23:42 GMT
GEODE-1544: Fail to initiate final check when network partition occurs

Currently, suspect request is only sent to a limited number of members,
when there are more than 4 members in the distributed system. It is
possible that the recipients of suspect request is unreachable due to
network partition. This fix makes sure that the recipients of suspect
request are not the suspect members. So that suspect request will be
processed.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/144e7d13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/144e7d13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/144e7d13

Branch: refs/heads/feature/GEODE-835
Commit: 144e7d135cdd3d73d0b291a8e3c089bf320bf400
Parents: 612a9d9
Author: Jianxia Chen <jchen@pivotal.io>
Authored: Thu Jun 16 09:49:03 2016 -0700
Committer: Jianxia Chen <jchen@pivotal.io>
Committed: Thu Jun 16 09:49:03 2016 -0700

----------------------------------------------------------------------
 .../distributed/internal/membership/NetView.java    | 10 ++++++----
 .../membership/gms/fd/GMSHealthMonitor.java         | 16 ++++------------
 .../internal/membership/NetViewJUnitTest.java       |  2 +-
 3 files changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/144e7d13/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
index 078281a..4c33e08 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/NetView.java
@@ -338,7 +338,7 @@ public class NetView implements DataSerializableFixedID {
         if (addr.equals(localAddress)) {
           continue;// this is must to add
         }
-        if (addr.getNetMember().preferredForCoordinator()) {
+        if (addr.getNetMember().preferredForCoordinator() && !filter.contains(addr))
{
           results.add(addr);
           if (results.size() >= maxNumberDesired) {
             break;
@@ -350,9 +350,11 @@ public class NetView implements DataSerializableFixedID {
 
       results.add(localAddress);// to add local address
 
-      if (notPreferredCoordinatorList.size() > 0) {
-        int idx = RANDOM.nextInt(notPreferredCoordinatorList.size());
-        results.add(notPreferredCoordinatorList.get(idx)); // to add non preferred local
address
+      if (results.size() < maxNumberDesired && notPreferredCoordinatorList.size()
> 0) {
+        Iterator<InternalDistributedMember> it = notPreferredCoordinatorList.iterator();
+        while (it.hasNext() && results.size() < maxNumberDesired) {
+          results.add(it.next());
+        }
       }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/144e7d13/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
index 203d9ce..e0f22a5 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/fd/GMSHealthMonitor.java
@@ -30,18 +30,7 @@ import java.net.InetAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketTimeoutException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
+import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutorService;
@@ -1335,6 +1324,9 @@ public class GMSHealthMonitor implements HealthMonitor, MessageHandler
{
     List<InternalDistributedMember> recipients;
     if (currentView.size() > 4) {
       HashSet<InternalDistributedMember> filter = new HashSet<InternalDistributedMember>();
+      for (Enumeration<InternalDistributedMember> e = suspectedMemberInView.keys();
e.hasMoreElements();) {
+        filter.add(e.nextElement());
+      }
       for (int i = 0; i < requests.size(); i++) {
         filter.add(requests.get(i).getSuspectMember());
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/144e7d13/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
index 5caf997..fbc4189 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/NetViewJUnitTest.java
@@ -99,7 +99,7 @@ public class NetViewJUnitTest {
     
     members.get(numMembers-1).getNetMember().setPreferredForCoordinator(true);
     List<InternalDistributedMember> preferred = view.getPreferredCoordinators(Collections.<InternalDistributedMember>singleton(members.get(1)),
members.get(0), 2);
-    assertEquals(3, preferred.size());
+    assertEquals(2, preferred.size());
     assertEquals(members.get(numMembers-1), preferred.get(0));
   }
   


Mime
View raw message