You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2016/04/12 15:32:44 UTC

[2/4] activemq git commit: https://issues.apache.org/jira/browse/AMQ-6203

https://issues.apache.org/jira/browse/AMQ-6203

Expose configuration on the persistence adapter level.
Double the test timeout and increase the compaction frequency to account
for very slow CI boxes.
(cherry picked from commit a9521dcebfb4e469dde7465ff95d8e8f1f050abd)


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

Branch: refs/heads/activemq-5.13.x
Commit: 72eecbe26002c29c10617713fae7d7ec6a97bc67
Parents: 2a7255a
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Mar 15 12:02:40 2016 -0400
Committer: Christopher L. Shannon (cshannon) <ch...@gmail.com>
Committed: Tue Apr 12 12:34:27 2016 +0000

----------------------------------------------------------------------
 .../store/kahadb/KahaDBPersistenceAdapter.java  | 33 ++++++++++++++++++++
 .../TransactedStoreUsageSuspendResumeTest.java  |  5 +--
 2 files changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/72eecbe2/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java
----------------------------------------------------------------------
diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java
index ebe12f3..b6b2ca7 100644
--- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java
+++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java
@@ -636,6 +636,39 @@ public class KahaDBPersistenceAdapter extends LockableServiceSupport implements
         return letter.isEnableIndexPageCaching();
     }
 
+    public int getCompactAcksAfterNoGC() {
+        return letter.getCompactAcksAfterNoGC();
+    }
+
+    /**
+     * Sets the number of GC cycles where no journal logs were removed before an attempt to
+     * move forward all the acks in the last log that contains them and is otherwise unreferenced.
+     * <p>
+     * A value of -1 will disable this feature.
+     *
+     * @param compactAcksAfterNoGC
+     *      Number of empty GC cycles before we rewrite old ACKS.
+     */
+    public void setCompactAcksAfterNoGC(int compactAcksAfterNoGC) {
+        this.letter.setCompactAcksAfterNoGC(compactAcksAfterNoGC);
+    }
+
+    public boolean isCompactAcksIgnoresStoreGrowth() {
+        return this.letter.isCompactAcksIgnoresStoreGrowth();
+    }
+
+    /**
+     * Configure if Ack compaction will occur regardless of continued growth of the
+     * journal logs meaning that the store has not run out of space yet.  Because the
+     * compaction operation can be costly this value is defaulted to off and the Ack
+     * compaction is only done when it seems that the store cannot grow and larger.
+     *
+     * @param compactAcksIgnoresStoreGrowth the compactAcksIgnoresStoreGrowth to set
+     */
+    public void setCompactAcksIgnoresStoreGrowth(boolean compactAcksIgnoresStoreGrowth) {
+        this.letter.setCompactAcksIgnoresStoreGrowth(compactAcksIgnoresStoreGrowth);
+    }
+
     public KahaDBStore getStore() {
         return letter;
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/72eecbe2/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java
index 6b11f71..28da159 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java
@@ -110,6 +110,7 @@ public class TransactedStoreUsageSuspendResumeTest {
         KahaDBPersistenceAdapter kahaDB = new KahaDBPersistenceAdapter();
         kahaDB.setJournalMaxFileLength(256 * 1024);
         kahaDB.setCleanupInterval(10*1000);
+        kahaDB.setCompactAcksAfterNoGC(5);
         broker.setPersistenceAdapter(kahaDB);
 
         broker.getSystemUsage().getStoreUsage().setLimit(7*1024*1024);
@@ -139,7 +140,7 @@ public class TransactedStoreUsageSuspendResumeTest {
             }
         });
         sendExecutor.shutdown();
-        sendExecutor.awaitTermination(5, TimeUnit.MINUTES);
+        sendExecutor.awaitTermination(10, TimeUnit.MINUTES);
 
         boolean allMessagesReceived = messagesReceivedCountDown.await(10, TimeUnit.MINUTES);
         if (!allMessagesReceived) {
@@ -148,7 +149,7 @@ public class TransactedStoreUsageSuspendResumeTest {
         assertTrue("Got all messages: " + messagesReceivedCountDown, allMessagesReceived);
 
         // give consumers a chance to exit gracefully
-        TimeUnit.SECONDS.sleep(2);
+        TimeUnit.SECONDS.sleep(5);
     }
 
     private void sendMessages() throws Exception {