Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA60CDBA0 for ; Wed, 17 Oct 2012 15:12:20 +0000 (UTC) Received: (qmail 99771 invoked by uid 500); 17 Oct 2012 15:12:20 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 99744 invoked by uid 500); 17 Oct 2012 15:12:20 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 99737 invoked by uid 99); 17 Oct 2012 15:12:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2012 15:12:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2012 15:12:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D1BCF2388A33 for ; Wed, 17 Oct 2012 15:11:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: gtully@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121017151130.D1BCF2388A33@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 } 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()); 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());