activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1372859 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/store/kahadb/KahaDBStore.java main/java/org/apache/activemq/store/kahadb/MessageDatabase.java test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java
Date Tue, 14 Aug 2012 12:35:26 GMT
Author: dejanb
Date: Tue Aug 14 12:35:26 2012
New Revision: 1372859

URL: http://svn.apache.org/viewvc?rev=1372859&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3973 - data.db not calculated in store size

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java?rev=1372859&r1=1372858&r2=1372859&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
Tue Aug 14 12:35:26 2012
@@ -65,7 +65,6 @@ import org.apache.activemq.usage.MemoryU
 import org.apache.activemq.usage.SystemUsage;
 import org.apache.activemq.util.ServiceStopper;
 import org.apache.activemq.wireformat.WireFormat;
-import org.apache.kahadb.util.ByteSequence;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.kahadb.journal.Location;
@@ -994,7 +993,11 @@ public class KahaDBStore extends Message
     }
 
     public long size() {
-        return storeSize.get();
+        try {
+            return journalSize.get() + getPageFile().getDiskSize();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     public void beginTransaction(ConnectionContext context) throws IOException {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java?rev=1372859&r1=1372858&r2=1372859&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
Tue Aug 14 12:35:26 2012
@@ -207,7 +207,7 @@ public abstract class MessageDatabase ex
     protected boolean enableJournalDiskSyncs=true;
     protected boolean archiveDataLogs;
     protected File directoryArchive;
-    protected AtomicLong storeSize = new AtomicLong(0);
+    protected AtomicLong journalSize = new AtomicLong(0);
     long checkpointInterval = 5*1000;
     long cleanupInterval = 30*1000;
     int journalMaxFileLength = Journal.DEFAULT_MAX_FILE_LENGTH;
@@ -2170,7 +2170,7 @@ public abstract class MessageDatabase ex
         manager.setChecksum(checksumJournalFiles || checkForCorruptJournalFiles);
         manager.setWriteBatchSize(getJournalMaxWriteBatchSize());
         manager.setArchiveDataLogs(isArchiveDataLogs());
-        manager.setSizeAccumulator(storeSize);
+        manager.setSizeAccumulator(journalSize);
         manager.setEnableAsyncDiskSync(isEnableJournalDiskSyncs());
         if (getDirectoryArchive() != null) {
             IOHelper.mkdirs(getDirectoryArchive());

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java?rev=1372859&r1=1372858&r2=1372859&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java
Tue Aug 14 12:35:26 2012
@@ -92,6 +92,8 @@ public class KahaDBFastEnqueueTest {
         LOG.info("Rate:                       " + (toSend * 1000/duration) + "m/s");
         LOG.info("Total send:             " + totalSent);
         LOG.info("Total journal write: " + kahaDBPersistenceAdapter.getStore().getJournal().length());
+        LOG.info("Total index size " + kahaDBPersistenceAdapter.getStore().getPageFile().getDiskSize());
+        LOG.info("Total store size: " + kahaDBPersistenceAdapter.size());
         LOG.info("Journal writes %:    " + kahaDBPersistenceAdapter.getStore().getJournal().length()
/ (double)totalSent * 100 + "%");
 
         restartBroker(0, 1200000);
@@ -134,6 +136,8 @@ public class KahaDBFastEnqueueTest {
         LOG.info("Rate:                       " + (toSend * 1000/duration) + "m/s");
         LOG.info("Total send:             " + totalSent);
         LOG.info("Total journal write: " + kahaDBPersistenceAdapter.getStore().getJournal().length());
+        LOG.info("Total index size " + kahaDBPersistenceAdapter.getStore().getPageFile().getDiskSize());
+        LOG.info("Total store size: " + kahaDBPersistenceAdapter.size());
         LOG.info("Journal writes %:    " + kahaDBPersistenceAdapter.getStore().getJournal().length()
/ (double)totalSent * 100 + "%");
 
         restartBroker(0, 0);



Mime
View raw message