activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/3] activemq-artemis git commit: ARTEMIS-1737 fix for inaccessible slave console after failover
Date Fri, 09 Mar 2018 15:10:08 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 27a4a1dfc -> 2cc163da7


ARTEMIS-1737 fix for inaccessible slave console after failover


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

Branch: refs/heads/master
Commit: dc096f950d24e47f48883fdd49b27f51914d5783
Parents: 27a4a1d
Author: Stanislav Knot <sknot@redhat.com>
Authored: Thu Mar 8 11:03:37 2018 +0100
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Mar 8 23:32:44 2018 -0500

----------------------------------------------------------------------
 .../artemis/core/server/ActiveMQServer.java     |  4 +++
 .../core/server/impl/ActiveMQServerImpl.java    | 10 ++++++++
 .../impl/SharedNothingLiveActivation.java       |  2 +-
 tests/integration-tests/pom.xml                 |  6 +++++
 .../failover/ReplicatedFailoverTest.java        | 26 ++++++++++++++++++++
 5 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc096f95/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
index 88c25a8..cc53e99 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java
@@ -432,6 +432,8 @@ public interface ActiveMQServer extends ServiceComponent {
 
    void fail(boolean failoverOnServerShutdown) throws Exception;
 
+   void backToBackup(boolean failoverOnServerShutdown) throws Exception;
+
    Queue updateQueue(String name,
                      RoutingType routingType,
                      Integer maxConsumers,
@@ -472,6 +474,8 @@ public interface ActiveMQServer extends ServiceComponent {
 
    void addExternalComponent(ActiveMQComponent externalComponent);
 
+   List<ActiveMQComponent> getExternalComponents();
+
    boolean addClientConnection(String clientId, boolean unique);
 
    void removeClientConnection(String clientId);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc096f95/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 1f0dbd6..ea485e3 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -915,6 +915,11 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       stop(failoverOnServerShutdown, false, false, true);
    }
 
+   @Override
+   public final void backToBackup(boolean failoverOnServerShutdown) throws Exception {
+      stop(failoverOnServerShutdown, false, false, false);
+   }
+
    public final void stop(boolean failoverOnServerShutdown, boolean isExit) throws Exception
{
       stop(failoverOnServerShutdown, false, false, isExit);
    }
@@ -3124,4 +3129,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
    public Set<ActivateCallback> getActivateCallbacks() {
       return activateCallbacks;
    }
+
+   @Override
+   public List<ActiveMQComponent> getExternalComponents() {
+      return externalComponents;
+   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc096f95/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
index 2e289b5..eaba72d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedNothingLiveActivation.java
@@ -187,7 +187,7 @@ public class SharedNothingLiveActivation extends LiveActivation {
                      clusterConnection.addClusterTopologyListener(listener1);
                      if (listener1.waitForBackup()) {
                         //if we have to many backups kept or are not configured to restart
just stop, otherwise restart as a backup
-                        activeMQServer.fail(true);
+                        activeMQServer.backToBackup(true);
                         ActiveMQServerLogger.LOGGER.restartingReplicatedBackupAfterFailback();
                         //                        activeMQServer.moveServerData(replicatedPolicy.getReplicaPolicy().getMaxSavedReplicatedJournalsSize());
                         activeMQServer.setHAPolicy(replicatedPolicy.getReplicaPolicy());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc096f95/tests/integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml
index bf3f575..5362b1e 100644
--- a/tests/integration-tests/pom.xml
+++ b/tests/integration-tests/pom.xml
@@ -275,6 +275,12 @@
          <artifactId>slf4j-api</artifactId>
          <version>1.7.5</version>
       </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-web</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
 
       <!-- DB Test Deps -->
       <dependency>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dc096f95/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java
index 88ac5e0..6639044 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedFailoverTest.java
@@ -16,12 +16,17 @@
  */
 package org.apache.activemq.artemis.tests.integration.cluster.failover;
 
+import java.util.ArrayList;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.component.WebServerComponent;
 import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
 import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
+import org.apache.activemq.artemis.core.server.ServiceComponent;
 import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
+import org.apache.activemq.artemis.dto.AppDTO;
+import org.apache.activemq.artemis.dto.WebServerDTO;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestRule;
@@ -125,6 +130,27 @@ public class ReplicatedFailoverTest extends FailoverTest {
       }
    }
 
+   @Test
+   public void testReplicatedFailbackBackupFromLiveBackToBackup() throws Exception {
+      WebServerDTO wdto = new WebServerDTO();
+      AppDTO appDTO = new AppDTO();
+      appDTO.war = "console.war";
+      appDTO.url = "console";
+      wdto.apps = new ArrayList<AppDTO>();
+      wdto.apps.add(appDTO);
+      wdto.bind = "http://localhost:0";
+      wdto.path = "console";
+      WebServerComponent webServerComponent = new WebServerComponent();
+      webServerComponent.configure(wdto, ".", ".");
+      webServerComponent.start();
+
+      backupServer.getServer().addExternalComponent(webServerComponent);
+      // this is called when backup servers go from live back to backup
+      backupServer.getServer().backToBackup(true);
+      assertTrue(backupServer.getServer().getExternalComponents().get(0).isStarted());
+      ((ServiceComponent)(backupServer.getServer().getExternalComponents().get(0))).stop(true);
+
+   }
    @Override
    protected void createConfigs() throws Exception {
       createReplicatedConfigs();


Mime
View raw message