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-890 Improving Paging consistencies with broker.persistent = false. Block, Page and Drop will now work under non persistent
Date Wed, 14 Dec 2016 19:40:51 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/1.x af443d705 -> 99a62f75f


ARTEMIS-890 Improving Paging consistencies with broker.persistent = false. Block, Page and
Drop will now work under non persistent

(cherry picked from commit 332338d018dbb7a491a669e0b749ea20fd157b7a)


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

Branch: refs/heads/1.x
Commit: 99a62f75f28c7e7efe325edd7db257bc3f220f96
Parents: af443d7
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Wed Dec 14 12:01:16 2016 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Dec 14 14:40:38 2016 -0500

----------------------------------------------------------------------
 .../apache/activemq/artemis/cli/commands/Create.java |  6 ++++++
 .../activemq/artemis/cli/commands/etc/broker.xml     |  2 +-
 .../artemis/core/paging/impl/PagingStoreImpl.java    |  8 ++++++--
 .../persistence/impl/nullpm/NullStorageManager.java  | 15 +++++++++++++--
 .../artemis/tests/integration/paging/PagingTest.java | 13 +++++++++++--
 5 files changed, 37 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/99a62f75/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index 1ae82b3..1121321 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -714,6 +714,12 @@ public class Create extends InputAbstract {
          filters.put("${hornetq-acceptor}", applyFilters(readTextFile(ETC_HORNETQ_ACCEPTOR_TXT),
filters));
       }
 
+      if (disablePersistence) {
+         filters.put("${full-policy}", "BLOCK");
+      } else {
+         filters.put("${full-policy}", "PAGE");
+      }
+
       performAutoTune(filters, aio, dataFolder);
 
       write(ETC_BROKER_XML, filters, false);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/99a62f75/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
index 23f2109..1f301ee 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
@@ -95,7 +95,7 @@ ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st
             <!-- with -1 only the global-max-size is in use for limiting -->
             <max-size-bytes>-1</max-size-bytes>
             <message-counter-history-day-limit>10</message-counter-history-day-limit>
-            <address-full-policy>PAGE</address-full-policy>
+            <address-full-policy>${full-policy}</address-full-policy>
          </address-setting>
       </address-settings>
    </core>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/99a62f75/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
index ce21081..54992e4 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java
@@ -797,7 +797,9 @@ public class PagingStoreImpl implements PagingStore {
          lock.readLock().unlock();
       }
 
-      managerLock.lock();
+      if (managerLock != null) {
+         managerLock.lock();
+      }
       try {
          lock.writeLock().lock();
 
@@ -852,7 +854,9 @@ public class PagingStoreImpl implements PagingStore {
             lock.writeLock().unlock();
          }
       } finally {
-         managerLock.unlock();
+         if (managerLock != null) {
+            managerLock.unlock();
+         }
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/99a62f75/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
index b311888..44ae44f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/nullpm/NullStorageManager.java
@@ -529,12 +529,23 @@ public class NullStorageManager implements StorageManager {
       // no-op
    }
 
+
    @Override
-   public boolean addToPage(PagingStore s,
+   public boolean addToPage(PagingStore store,
                             ServerMessage msg,
                             Transaction tx,
                             RouteContextList listCtx) throws Exception {
-      return false;
+      /**
+       * Exposing the read-lock here is an encapsulation violation done in order to keep
the code
+       * simpler. The alternative would be to add a second method, say 'verifyPaging', to
+       * PagingStore.
+       * <p>
+       * Adding this second method would also be more surprise prone as it would require
a certain
+       * calling order.
+       * <p>
+       * The reasoning is that exposing the lock is more explicit and therefore `less bad`.
+       */
+      return store.page(msg, tx, listCtx, null);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/99a62f75/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
index 63097cf..068a299 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java
@@ -3327,7 +3327,16 @@ public class PagingTest extends ActiveMQTestBase {
    }
 
    @Test
-   public void testDropMessages() throws Exception {
+   public void testDropMessagesPersistent() throws Exception {
+      testDropMessages(true);
+   }
+
+   @Test
+   public void testDropMessagesNonPersistent() throws Exception {
+      testDropMessages(false);
+   }
+
+   public void testDropMessages(final boolean persistent) throws Exception {
       clearDataRecreateServerDirs();
 
       HashMap<String, AddressSettings> settings = new HashMap<>();
@@ -3337,7 +3346,7 @@ public class PagingTest extends ActiveMQTestBase {
 
       settings.put(PagingTest.ADDRESS.toString(), set);
 
-      server = createServer(true, createDefaultInVMConfig(), 1024, 10 * 1024, settings);
+      server = createServer(persistent, createDefaultInVMConfig(), 1024, 10 * 1024, settings);
 
       server.start();
 


Mime
View raw message