git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1372859 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2012-08-14 12:35:26 +00:00
parent ce50e287ac
commit a60442458e
3 changed files with 11 additions and 4 deletions

View File

@ -65,7 +65,6 @@ import org.apache.activemq.usage.MemoryUsage;
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 MessageDatabase implements PersistenceAdapter {
}
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 {

View File

@ -207,7 +207,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
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 extends ServiceSupport implements BrokerSe
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());

View File

@ -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);