activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6352
Date Tue, 12 Jul 2016 14:28:33 GMT
Repository: activemq
Updated Branches:
  refs/heads/activemq-5.13.x 85da15723 -> 9c483fa47


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

Fixing PList size tracking by moving the null assignment on removal to
after the onRemoval method is called to make sure that the decrement is
done properly.

(cherry picked from commit d635a369404db25e1c450283a224ed89abf3c5a7)


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

Branch: refs/heads/activemq-5.13.x
Commit: 9c483fa477fd0202cd311d044e22d62eddd5d25f
Parents: 85da157
Author: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Authored: Tue Jul 12 10:26:58 2016 -0400
Committer: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Committed: Tue Jul 12 10:28:36 2016 -0400

----------------------------------------------------------------------
 .../broker/region/cursors/FilePendingMessageCursor.java        | 2 +-
 .../org/apache/activemq/store/kahadb/disk/index/ListNode.java  | 4 +++-
 .../java/org/apache/activemq/store/kahadb/plist/PListTest.java | 6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/9c483fa4/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
index 9c9a8e7..e6d34a6 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
@@ -353,7 +353,7 @@ public class FilePendingMessageCursor extends AbstractPendingMessageCursor
imple
 
     @Override
     public synchronized long messageSize() {
-        return memoryList.messageSize() + (isDiskListEmpty() ? 0 : (int)getDiskList().messageSize());
+        return memoryList.messageSize() + (isDiskListEmpty() ? 0 : getDiskList().messageSize());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/activemq/blob/9c483fa4/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
----------------------------------------------------------------------
diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
index 8fed042..9efcd25 100644
--- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
+++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/index/ListNode.java
@@ -203,7 +203,7 @@ public final class ListNode<Key, Value> {
             }
             try {
                 entryToRemove.unlink();
-                entryToRemove = null;
+
                 ListNode<Key, Value> toRemoveNode = null;
                 if (currentNode.entries.isEmpty()) {
                     // may need to free this node
@@ -237,7 +237,9 @@ public final class ListNode<Key, Value> {
                         currentNode = previousNode;
                     }
                 }
+
                 targetList.onRemove(entryToRemove);
+                entryToRemove = null;
 
                 if (toRemoveNode != null) {
                     tx.free(toRemoveNode.getPage());

http://git-wip-us.apache.org/repos/asf/activemq/blob/9c483fa4/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
index 555503e..1c33f1a 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java
@@ -32,6 +32,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.store.PList;
+import org.apache.activemq.store.PList.PListIterator;
 import org.apache.activemq.store.PListEntry;
 import org.apache.activemq.util.ByteSequence;
 import org.apache.activemq.util.IOHelper;
@@ -74,6 +75,7 @@ public class PListTest {
             plist.addLast(test, bs);
         }
         assertEquals(plist.size(), COUNT);
+        assertTrue(plist.messageSize() > 0);
         int count = 0;
         for (ByteSequence bs : map.values()) {
             String origStr = new String(bs.getData(), bs.getOffset(), bs.getLength());
@@ -95,6 +97,7 @@ public class PListTest {
             plist.addFirst(test, bs);
         }
         assertEquals(plist.size(), COUNT);
+        assertTrue(plist.messageSize() > 0);
         long count = plist.size() - 1;
         for (ByteSequence bs : map.values()) {
             String origStr = new String(bs.getData(), bs.getOffset(), bs.getLength());
@@ -125,6 +128,7 @@ public class PListTest {
             entry = plist.getFirst();
         }
         assertEquals(0, plist.size());
+        assertEquals(0, plist.messageSize());
     }
 
     @Test
@@ -132,6 +136,7 @@ public class PListTest {
         doTestRemove(1);
         plist.destroy();
         assertEquals(0, plist.size());
+        assertEquals(0, plist.messageSize());
     }
 
     @Test
@@ -146,6 +151,7 @@ public class PListTest {
         }
         plist.destroy();
         assertEquals(0, plist.size());
+        assertEquals(0, plist.messageSize());
     }
 
     @Test


Mime
View raw message