activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject [4/8] activemq git commit: https://issues.apache.org/jira/browse/AMQ-5164 https://issues.apache.org/jira/browse/AMQ-4842 - master slave advisory needed to wait for failover reconnect - exponential backoff was sometimes giving to long a delay. Retroactive
Date Wed, 20 May 2015 12:43:33 GMT
https://issues.apache.org/jira/browse/AMQ-5164 https://issues.apache.org/jira/browse/AMQ-4842
- master slave advisory needed to wait for failover reconnect - exponential backoff was sometimes
giving to long a delay. Retroactive override needs to applied after policies. Tests reinstated


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

Branch: refs/heads/master
Commit: 9ad65c62ed17eef62f62c901620ed2d57171a8d0
Parents: baa10ed
Author: gtully <gary.tully@gmail.com>
Authored: Wed May 20 09:56:38 2015 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Wed May 20 09:57:05 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/activemq/broker/region/Topic.java  | 13 ++++++-------
 .../broker/ft/QueueMasterSlaveSingleUrlTest.java       | 13 +------------
 .../broker/ft/QueueMasterSlaveTestSupport.java         | 11 ++++++++---
 .../broker/ft/kahaDbJdbcLeaseQueueMasterSlaveTest.java | 12 +++++++-----
 4 files changed, 22 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/9ad65c62/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
index a063125..21e0c1b 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
@@ -87,19 +87,18 @@ public class Topic extends BaseDestination implements Task {
             DestinationStatistics parentStats, TaskRunnerFactory taskFactory) throws Exception
{
         super(brokerService, store, destination, parentStats);
         this.topicStore = store;
-        // set default subscription recovery policy
-        if (AdvisorySupport.isMasterBrokerAdvisoryTopic(destination)) {
-            subscriptionRecoveryPolicy = new LastImageSubscriptionRecoveryPolicy();
-            setAlwaysRetroactive(true);
-        } else {
-            subscriptionRecoveryPolicy = new RetainedMessageSubscriptionRecoveryPolicy(null);
-        }
+        subscriptionRecoveryPolicy = new RetainedMessageSubscriptionRecoveryPolicy(null);
         this.taskRunner = taskFactory.createTaskRunner(this, "Topic  " + destination.getPhysicalName());
     }
 
     @Override
     public void initialize() throws Exception {
         super.initialize();
+        // set non default subscription recovery policy (override policyEntries)
+        if (AdvisorySupport.isMasterBrokerAdvisoryTopic(destination)) {
+            subscriptionRecoveryPolicy = new LastImageSubscriptionRecoveryPolicy();
+            setAlwaysRetroactive(true);
+        }
         if (store != null) {
             // AMQ-2586: Better to leave this stat at zero than to give the user
             // misleading metrics.

http://git-wip-us.apache.org/repos/asf/activemq/blob/9ad65c62/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
index 7dc88f7..b7a35f4 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveSingleUrlTest.java
@@ -28,7 +28,7 @@ import org.junit.Ignore;
 
 public class QueueMasterSlaveSingleUrlTest extends QueueMasterSlaveTestSupport {
     private final String brokerUrl = "tcp://localhost:62001";
-    private final String singleUriString = "failover://(" + brokerUrl +")?randomize=false";
+    private final String singleUriString = "failover://(" + brokerUrl +")?randomize=false&useExponentialBackOff=false";
 
     @Override
     protected void setUp() throws Exception {
@@ -81,15 +81,4 @@ public class QueueMasterSlaveSingleUrlTest extends QueueMasterSlaveTestSupport
{
         }).start();
     }
 
-
-    // The @Ignore is just here for documentation, since this is a JUnit3 test
-    // I added the sleep because without it the two other test cases fail.  I haven't looked
into it, but
-    // my guess whatever setUp does isn't really finished when the teardown runs.
-    @Ignore("See https://issues.apache.org/jira/browse/AMQ-5164")
-    @Override
-    public void testAdvisory() throws Exception {
-        Thread.sleep(5 * 1000);
-        //super.testAdvisory();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/9ad65c62/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java
index 2808ebe..a7a525e 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java
@@ -44,13 +44,15 @@ abstract public class QueueMasterSlaveTestSupport extends JmsTopicSendReceiveWit
 
     protected BrokerService master;
     protected AtomicReference<BrokerService> slave = new AtomicReference<BrokerService>();
-    protected CountDownLatch slaveStarted = new CountDownLatch(1);
+    protected CountDownLatch slaveStarted;
     protected int inflightMessageCount;
     protected int failureCount = 50;
     protected String uriString = "failover://(tcp://localhost:62001,tcp://localhost:62002)?randomize=false&useExponentialBackOff=false";
 
     @Override
     protected void setUp() throws Exception {
+        slaveStarted = new CountDownLatch(1);
+        slave.set(null);
         setMaxTestTime(TimeUnit.MINUTES.toMillis(10));
         setAutoFail(true);
         if (System.getProperty("basedir") == null) {
@@ -137,18 +139,21 @@ abstract public class QueueMasterSlaveTestSupport extends JmsTopicSendReceiveWit
 
         qConsumer = session.createConsumer(new ActiveMQQueue("Consumer.A.VirtualTopic.TA1"));
 
-        javax.jms.Message message = qConsumer.receive(4000);
+        javax.jms.Message message = qConsumer.receive(20000);
         assertNotNull("Get message after failover", message);
         assertEquals("correct message", text, ((TextMessage)message).getText());
     }
 
     public void testAdvisory() throws Exception {
         MessageConsumer advConsumer = session.createConsumer(AdvisorySupport.getMasterBrokerAdvisoryTopic());
+        Message advisoryMessage = advConsumer.receive(5000);
+        LOG.info("received " + advisoryMessage);
+        assertNotNull("Didn't received advisory", advisoryMessage);
 
         master.stop();
         assertTrue("slave started", slaveStarted.await(60, TimeUnit.SECONDS));
         LOG.info("slave started");
-        Message advisoryMessage = advConsumer.receive(5000);
+        advisoryMessage = advConsumer.receive(20000);
         LOG.info("received " + advisoryMessage);
         assertNotNull("Didn't received advisory", advisoryMessage);
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/9ad65c62/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/kahaDbJdbcLeaseQueueMasterSlaveTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/kahaDbJdbcLeaseQueueMasterSlaveTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/kahaDbJdbcLeaseQueueMasterSlaveTest.java
index ee7ca0f..4cfb5e3 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/kahaDbJdbcLeaseQueueMasterSlaveTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/ft/kahaDbJdbcLeaseQueueMasterSlaveTest.java
@@ -34,12 +34,19 @@ public class kahaDbJdbcLeaseQueueMasterSlaveTest extends QueueMasterSlaveTestSup
     protected String MASTER_URL = "tcp://localhost:62001";
     protected String SLAVE_URL  = "tcp://localhost:62002";
 
+    @Override
     protected void setUp() throws Exception {
         // startup db
         sharedDs = new SyncCreateDataSource((EmbeddedDataSource) DataSourceServiceSupport.createDataSource(IOHelper.getDefaultDataDirectory()));
         super.setUp();
     }
 
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        DataSourceServiceSupport.shutdownDefaultDataSource(((SyncCreateDataSource)sharedDs).getDelegate());
+    }
+
     protected void createMaster() throws Exception {
         master = new BrokerService();
         master.setBrokerName("master");
@@ -102,11 +109,6 @@ public class kahaDbJdbcLeaseQueueMasterSlaveTest extends QueueMasterSlaveTestSup
         kahaDBPersistenceAdapter.getLocker().setLockAcquireSleepInterval(500);
     }
 
-    @Override
-    public void testVirtualTopicFailover() throws Exception {
-        // Ignoring for now, see AMQ-4842
-    }
-
     protected DataSource getExistingDataSource() throws Exception {
         return sharedDs;
     }


Mime
View raw message