activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1399300 - in /activemq/trunk: activemq-core/src/test/java/org/apache/activemq/usecases/ kahadb/src/main/java/org/apache/kahadb/index/ kahadb/src/main/java/org/apache/kahadb/util/ kahadb/src/test/java/org/apache/kahadb/index/
Date Wed, 17 Oct 2012 15:11:30 GMT
Author: gtully
Date: Wed Oct 17 15:11:30 2012
New Revision: 1399300

URL: http://svn.apache.org/viewvc?rev=1399300&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-4094 - ensure list is split down to single entry
before page over flow for a value, ensures the smallest marshall size for a page

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java
    activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java
    activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java
    activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java?rev=1399300&r1=1399299&r2=1399300&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java
Wed Oct 17 15:11:30 2012
@@ -167,6 +167,12 @@ public class DurableSubsOfflineSelectorI
         assertEquals(messageCount / 2, listenerT.count);
         assertEquals(messageCount / 2, listenerF.count);
 
+        consumerTrue.close();
+        session.unsubscribe("true");
+
+        consumerFalse.close();
+        session.unsubscribe("false");
+
         session.close();
         con.close();
 
@@ -195,14 +201,6 @@ public class DurableSubsOfflineSelectorI
 
     }
 
-    private void dumpstats() throws Exception {
-        //TimeUnit.SECONDS.sleep(2);
-        //ThreadTracker.result();
-        TimeUnit.SECONDS.sleep(4);
-
-
-    }
-
     public static class Listener implements MessageListener {
         int count = 0;
         String id = null;

Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java?rev=1399300&r1=1399299&r2=1399300&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java (original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java Wed Oct 17 15:11:30
2012
@@ -309,19 +309,14 @@ public final class ListNode<Key, Value> 
     }
 
     public void storeUpdate(Transaction tx) throws IOException {
-        getContainingList().storeNode(tx, this, true);
+        store(tx, ADD_LAST);
     }
 
     private void store(Transaction tx, boolean addFirst) throws IOException {
         try {
-            // When we split to a node of one element we can span multiple pages for that
-            // entry, otherwise we keep the entries on one page to avoid fragmented reads
-            // and segment the list traversal.
-            if (this.entries.size() == 1) {
-                getContainingList().storeNode(tx, this, true);
-            } else {
-                getContainingList().storeNode(tx, this, false);
-            }
+            // keeping splitting till we get down to a single entry
+            // then we need to overflow the value
+            getContainingList().storeNode(tx, this, entries.size() == 1);
 
             if (this.next == -1) {
                 getContainingList().setTailPageId(getPageId());
@@ -347,6 +342,7 @@ public final class ListNode<Key, Value> 
             this.setNext(extension.getPageId());
         } else {
             extension.setEntries(entries.getTail().getPrevious().splitAfter());
+            extension.setNext(this.getNext());
             extension.store(tx, isAddFirst);
             getContainingList().setTailPageId(extension.getPageId());
             this.setNext(extension.getPageId());

Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java?rev=1399300&r1=1399299&r2=1399300&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java (original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java Wed Oct 17
15:11:30 2012
@@ -107,7 +107,14 @@ public class SequenceSet extends LinkedN
             return true;
         }
 
-        Sequence sequence = getHead();
+        // check for append
+        Sequence sequence = getTail();
+        if (sequence.isAdjacentToLast(value)) {
+            sequence.last = value;
+            return true;
+        }
+
+        sequence = getHead();
         while (sequence != null) {
 
             if (sequence.isAdjacentToLast(value)) {

Modified: activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java?rev=1399300&r1=1399299&r2=1399300&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java (original)
+++ activemq/trunk/kahadb/src/test/java/org/apache/kahadb/index/ListIndexTest.java Wed Oct
17 15:11:30 2012
@@ -516,7 +516,7 @@ public class ListIndexTest extends Index
         int expectedListEntries = 0;
         int nextSequenceId = 0;
 
-        LOG.info("Loading up the ListIndex with "+NUM_ITERATIONS+" entires and sparsely populating
the sequences.");
+        LOG.info("Loading up the ListIndex with "+NUM_ITERATIONS+" entries and sparsely populating
the sequences.");
 
         for (int i = 0; i < NUM_ITERATIONS; ++i) {
             test.add(tx, String.valueOf(expectedListEntries++), new SequenceSet());



Mime
View raw message