activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1224890 - /activemq/trunk/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java
Date Tue, 27 Dec 2011 10:41:28 GMT
Author: dejanb
Date: Tue Dec 27 10:41:28 2011
New Revision: 1224890

URL: http://svn.apache.org/viewvc?rev=1224890&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3374 - don't count every write in transaction size
as only the number of pages we keep in memory is relevant (multiple writes to the same page
will overwrite themselves)

Modified:
    activemq/trunk/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java

Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java?rev=1224890&r1=1224889&r2=1224890&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java (original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/page/Transaction.java Tue Dec 27
10:41:28 2011
@@ -16,12 +16,14 @@
  */
 package org.apache.kahadb.page;
 
-import java.io.*;
-import java.util.*;
-
 import org.apache.kahadb.page.PageFile.PageWrite;
 import org.apache.kahadb.util.*;
 
+import java.io.*;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.TreeMap;
+
 /**
  * The class used to read/update a PageFile object.  Using a transaction allows you to
  * do multiple update operations in a single unit of work.
@@ -700,9 +702,12 @@ public class Transaction implements Iter
     @SuppressWarnings("unchecked")
     private void write(final Page page, byte[] data) throws IOException {
         Long key = page.getPageId();
-        size += data.length;
+
+        // how much pages we have for this transaction
+        size = writes.size() * pageFile.getPageSize();
 
         PageWrite write;
+        
         if (size > maxTransactionSize) {
             if (tmpFile == null) {
                 tmpFile = new RandomAccessFile(getTempFile(), "rw");



Mime
View raw message