activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: ARTEMIS-1154 isolated backup fails over
Date Tue, 09 May 2017 20:41:19 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/1.x c7dc04c2a -> 7e4de767b


ARTEMIS-1154 isolated backup fails over

Even if there is no address/url configured for the NetworkHealthCheck
an isolated backup will still fail-over potentially causing split-brain.

(cherry picked from commit 5cb5c8a6dc7179078f099d5455343e1f18fd3398)


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/7e4de767
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/7e4de767
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/7e4de767

Branch: refs/heads/1.x
Commit: 7e4de767b70065aa9b911dd8171f0a5f9ee6369d
Parents: c7dc04c
Author: Justin Bertram <jbertram@apache.org>
Authored: Tue May 9 14:43:17 2017 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue May 9 16:41:14 2017 -0400

----------------------------------------------------------------------
 .../artemis/core/server/NetworkHealthCheck.java   | 18 ++++++++++++------
 .../cluster/qourum/SharedNothingBackupQuorum.java |  2 +-
 2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7e4de767/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
index ec98aad..cabd045 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/core/server/NetworkHealthCheck.java
@@ -298,25 +298,27 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
 
    }
 
+   /**
+    * @return true if no checks were done or if one address/url responds; false if all addresses/urls
fail
+    */
    public boolean check() {
-      boolean isEmpty = true;
+      if (isEmpty()) {
+         return true;
+      }
+
       for (InetAddress address : addresses) {
-         isEmpty = false;
          if (check(address)) {
             return true;
          }
       }
 
       for (URL url : urls) {
-         isEmpty = false;
          if (check(url)) {
             return true;
          }
       }
 
-      // This should return true if no checks were done, on this case it's empty
-      // This is tested by {@link NetworkHe
-      return isEmpty;
+      return false;
    }
 
    public boolean check(InetAddress address) {
@@ -397,4 +399,8 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {
          return false;
       }
    }
+
+   public boolean isEmpty() {
+      return addresses.isEmpty() && urls.isEmpty();
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/7e4de767/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java
index b3e9c32..51d2487 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/qourum/SharedNothingBackupQuorum.java
@@ -105,7 +105,7 @@ public class SharedNothingBackupQuorum implements Quorum, SessionFailureListener
             signal = BACKUP_ACTIVATION.FAIL_OVER;
          }
 
-         if (networkHealthCheck != null && networkHealthCheck.check()) {
+         if (networkHealthCheck != null && !networkHealthCheck.isEmpty() &&
networkHealthCheck.check()) {
             // live is assumed to be down, backup fails-over
             signal = BACKUP_ACTIVATION.FAIL_OVER;
          } else {


Mime
View raw message