geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [geode] branch feature/GEODE-6423 updated: fixing problems in auto-reconnect tests
Date Thu, 21 Feb 2019 22:06:27 GMT
This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch feature/GEODE-6423
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-6423 by this push:
     new 30334c2  fixing problems in auto-reconnect tests
30334c2 is described below

commit 30334c2a7cbc07df61b655171d7178e653adc0c5
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
AuthorDate: Thu Feb 21 14:03:12 2019 -0800

    fixing problems in auto-reconnect tests
    
    The longer period of time taken in final checks exposed more race
    conditions in auto-reconnect.  To avoid those race conditions I've
    modified JGroupsMessenger to force the JChannel to generate a new UUID
    that will be used in the DistributedMember ID of the reconnected cache.
---
 .../membership/gms/membership/GMSJoinLeave.java         |  1 +
 .../membership/gms/messenger/JGroupsMessenger.java      | 17 ++++++++++++-----
 .../geode/test/dunit/rules/ClusterStartupRule.java      |  2 +-
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
index 261bb70..c3e0f1d 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java
@@ -1036,6 +1036,7 @@ public class GMSJoinLeave implements JoinLeave, MessageHandler {
             this.preparedView.getCreator().equals(view.getCreator())) {
           // this can happen if we received two prepares during auto-reconnect
         } else {
+          // send the conflicting view to the creator of this new view
           services.getMessenger()
               .send(new ViewAckMessage(view.getViewId(), m.getSender(), this.preparedView));
         }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
index 8475bcb..d365bb7 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/messenger/JGroupsMessenger.java
@@ -332,9 +332,16 @@ public class JGroupsMessenger implements Messenger {
         members.add(new UUID(0, 0));// TODO open a JGroups JIRA for GEODE-3034
         View jgv = new View(vid, members);
         this.myChannel.down(new Event(Event.VIEW_CHANGE, jgv));
-        UUID logicalAddress = (UUID) myChannel.getAddress();
-        if (logicalAddress instanceof JGAddress) {
-          ((JGAddress) logicalAddress).setVmViewId(-1);
+        // attempt to establish a new UUID in the jgroups channel so the member address will
be
+        // different
+        try {
+          Method setAddressMethod = JChannel.class.getDeclaredMethod("setAddress");
+          setAddressMethod.setAccessible(true);
+          setAddressMethod.invoke(myChannel);
+        } catch (SecurityException | NoSuchMethodException e) {
+          logger.warn("Unable to establish a new JGroups address.  "
+              + "My address will be exactly the same as last time. Exception={}",
+              e.getMessage());
         }
         reconnecting = true;
       } else {
@@ -364,7 +371,7 @@ public class JGroupsMessenger implements Messenger {
       jgroupsReceiver = new JGroupsReceiver();
       myChannel.setReceiver(jgroupsReceiver);
       if (!reconnecting) {
-        myChannel.connect("AG"); // apache g***** (whatever we end up calling it)
+        myChannel.connect("AG"); // Apache Geode
       }
     } catch (Exception e) {
       myChannel.close();
@@ -556,7 +563,7 @@ public class JGroupsMessenger implements Messenger {
     gmsMember.setMemberWeight((byte) (services.getConfig().getMemberWeight() & 0xff));
     gmsMember.setNetworkPartitionDetectionEnabled(
         services.getConfig().getDistributionConfig().getEnableNetworkPartitionDetection());
-
+    logger.info("Established local address {}", localAddress);
     services.setLocalAddress(localAddress);
   }
 
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java
b/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java
index cd87286..3d329aa 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java
@@ -250,7 +250,7 @@ public class ClusterStartupRule implements SerializableTestRule {
       SerializableFunction<ServerStarterRule> ruleOperator) {
     final String defaultName = "server-" + index;
     VM serverVM = getVM(index, version);
-    Server server = serverVM.invoke(() -> {
+    Server server = serverVM.invoke("startServerVM", () -> {
       memberStarter = new ServerStarterRule();
       ServerStarterRule serverStarter = (ServerStarterRule) memberStarter;
       if (logFile) {


Mime
View raw message