Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3844E200BDC for ; Wed, 14 Dec 2016 20:40:53 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 35A43160B19; Wed, 14 Dec 2016 19:40:53 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 56405160B0D for ; Wed, 14 Dec 2016 20:40:52 +0100 (CET) Received: (qmail 33258 invoked by uid 500); 14 Dec 2016 19:40:51 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 33245 invoked by uid 99); 14 Dec 2016 19:40:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Dec 2016 19:40:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 65EF7F16A3; Wed, 14 Dec 2016 19:40:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer 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 +0000 (UTC) archived-at: Wed, 14 Dec 2016 19:40:53 -0000 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 Authored: Wed Dec 14 12:01:16 2016 -0500 Committer: Clebert Suconic 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 -1 10 - PAGE + ${full-policy} 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. + *

+ * Adding this second method would also be more surprise prone as it would require a certain + * calling order. + *

+ * 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 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();