diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java index 6ad78b11bf..3e82117ed5 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java @@ -167,6 +167,12 @@ public class DurableSubsOfflineSelectorIndexUseTest extends org.apache.activemq. 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 DurableSubsOfflineSelectorIndexUseTest extends org.apache.activemq. } - 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; diff --git a/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java b/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java index 6ec5691f33..30096e4c00 100644 --- a/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java +++ b/kahadb/src/main/java/org/apache/kahadb/index/ListNode.java @@ -309,19 +309,14 @@ public final class ListNode { } 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 { 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()); diff --git a/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java b/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java index a3bdeae925..ac71c3669e 100644 --- a/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java +++ b/kahadb/src/main/java/org/apache/kahadb/util/SequenceSet.java @@ -107,7 +107,14 @@ public class SequenceSet extends LinkedNodeList implements Iterable