You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/12/14 19:40:25 UTC

[1/2] activemq-artemis git commit: ARTEMIS-890 Improving Paging consistencies with broker.persistent = false. Block, Page and Drop will now work under non persistent

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 6d10a372a -> c18ee8319


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


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

Branch: refs/heads/master
Commit: 332338d018dbb7a491a669e0b749ea20fd157b7a
Parents: 6d10a37
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Dec 14 12:01:16 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Dec 14 14:36:33 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/332338d0/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 7175c8d..5faa7a7 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/332338d0/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 ea51eb0..3e0d4e1 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
@@ -93,7 +93,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>
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/332338d0/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/332338d0/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 fac108e..2154879 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
@@ -540,12 +540,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/332338d0/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 21dd5b6..d6ac105 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
@@ -3329,7 +3329,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<>();
@@ -3339,7 +3348,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();
 


[2/2] activemq-artemis git commit: This closes #918

Posted by cl...@apache.org.
This closes #918


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

Branch: refs/heads/master
Commit: c18ee831904e8c9fed085b63a951c3fea3ce1194
Parents: 6d10a37 332338d
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Dec 14 14:37:09 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Dec 14 14:37:09 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(-)
----------------------------------------------------------------------