geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [18/45] incubator-geode git commit: GEODE-1005 When multiple locator started same time, they endup creating two DS
Date Tue, 15 Mar 2016 18:38:56 GMT
GEODE-1005 When multiple locator started same time, they endup creating two DS

Now we make sure in findCoordinater call that we give prefernce to member which
are in view.


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

Branch: refs/heads/feature/GEODE-1050
Commit: 5fcf03706cfd703012ddddbd728ea240966747c3
Parents: 8700acc
Author: Hitesh Khamesra <hkhamesra@pivotal.io>
Authored: Tue Mar 1 16:17:31 2016 -0800
Committer: Hitesh Khamesra <hkhamesra@pivotal.io>
Committed: Thu Mar 10 09:47:23 2016 -0800

----------------------------------------------------------------------
 .../membership/gms/membership/GMSJoinLeave.java | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5fcf0370/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index 3d8b2e5..85d76d6 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -933,7 +933,8 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
     }
 
     FindCoordinatorRequest request = new FindCoordinatorRequest(this.localAddress, state.alreadyTried,
state.viewId);
-    Set<InternalDistributedMember> coordinators = new HashSet<InternalDistributedMember>();
+    Set<InternalDistributedMember> possibleCoordinators = new HashSet<InternalDistributedMember>();
+    Set<InternalDistributedMember> coordinatorsWithView = new HashSet<InternalDistributedMember>();
 
     long giveUpTime = System.currentTimeMillis() + ((long) services.getConfig().getLocatorWaitTime()
* 1000L);
 
@@ -971,7 +972,11 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
                   state.registrants.addAll(response.getRegistrants());
                 }
               }
-              coordinators.add(response.getCoordinator());
+              if (viewId > -1) {
+                coordinatorsWithView.add(response.getCoordinator());
+              }
+              
+              possibleCoordinators.add(response.getCoordinator());
               if (!flagsSet) {
                 flagsSet = true;
                 inheritSettingsFromLocator(addr, response);
@@ -982,13 +987,16 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
         }
       }
     } while (!anyResponses && System.currentTimeMillis() < giveUpTime);
-
-    if (coordinators.isEmpty()) {
+    if (possibleCoordinators.isEmpty()) {
       return false;
     }
 
-    Iterator<InternalDistributedMember> it = coordinators.iterator();
-    if (coordinators.size() == 1) {
+    if (coordinatorsWithView.size() > 0) {
+      possibleCoordinators = coordinatorsWithView;// lets check current coordinators in view
only
+    }
+    
+    Iterator<InternalDistributedMember> it = possibleCoordinators.iterator();
+    if (possibleCoordinators.size() == 1) {
       state.possibleCoordinator = it.next();
     } else {
       InternalDistributedMember oldest = it.next();


Mime
View raw message