From: <fko...@us...> - 2010-10-08 22:22:05
|
Revision: 3761 http://bigdata.svn.sourceforge.net/bigdata/?rev=3761&view=rev Author: fkoliver Date: 2010-10-08 22:21:56 +0000 (Fri, 08 Oct 2010) Log Message: ----------- Change some subclasses of BTree into uses of BTree: EventBTree, CommitTimeIndex, CommitRecordIndex, JournalIndex, IndexSegmentIndex Users of these specialized trees should see only a specialized set of methods rather than the full inheritance from BTree. These classes should hide key/value conversion. Users should never need to see ITuple or ITupleSerializer. Removed unused CounterSetBTree. Modified Paths: -------------- branches/maven_scaleout/bigdata-core/pom.xml branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/AbstractBTree.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/BTree.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegment.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndex.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndexView.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/Node.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/ReadOnlyIndex.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/HardReferenceGlobalLRURecycler.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/LRUNexus.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/counters/httpd/DummyEventReportingService.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/AbstractJournal.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/CommitRecordIndex.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/journal/DumpJournal.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/loadbalancer/EmbeddedLoadBalancer.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/resources/IndexSegmentIndex.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/resources/JournalIndex.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/resources/ResourceEvents.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/resources/StoreManager.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/AbstractTransactionService.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/CommitTimeIndex.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/DistributedTransactionService.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/EventReceiver.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/LoadBalancerService.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/MetadataIndexCache.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/transaction/EmbeddedTransactionService.java branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/counters/TestAll.java branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/journal/TestCommitRecordIndex.java branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/service/TestDistributedTransactionServiceRestart.java branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/service/TestEventReceiver.java branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/service/TestSnapshotHelper.java Added Paths: ----------- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/EventBTree.java Removed Paths: ------------- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/DelegateIndex.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/counters/query/CounterSetBTreeSelector.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/counters/query/CounterSetLoader.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/counters/store/CounterSetBTree.java branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/counters/store/TestAll.java branches/maven_scaleout/bigdata-core/src/test/java/com/bigdata/counters/store/TestCounterSetBTree.java Modified: branches/maven_scaleout/bigdata-core/pom.xml =================================================================== --- branches/maven_scaleout/bigdata-core/pom.xml 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/pom.xml 2010-10-08 22:21:56 UTC (rev 3761) @@ -60,6 +60,8 @@ java files were getting recompiled and put into the bigdata jar. This setting forces javac to only look for source in the current maven source directory. --> <sourcepath>${project.build.sourceDirectory}</sourcepath> + <!-- <Xlint></Xlint> --> + <!-- <Xlint:unchecked></Xlint:unchecked> --> </compilerArguments> </configuration> </plugin> @@ -141,7 +143,7 @@ <!-- These system properties are required by the unit tests. --> <systemPropertyVariables> <java.security.policy>${java.security.policy}</java.security.policy> - <java.net.preferIPv4Stack>{java.net.preferIPv4Stack}"</java.net.preferIPv4Stack> + <java.net.preferIPv4Stack>{java.net.preferIPv4Stack}</java.net.preferIPv4Stack> <log4j.configuration>${log4j.configuration}</log4j.configuration> <app.home>${app.home}</app.home> <!-- This is the deployment directory, easily accessed by the DataFinder class. --> @@ -160,7 +162,7 @@ <fastutil.jar>${deploy.lib}/fastutil.jar</fastutil.jar> <icu4j.jar>${deploy.lib}/icu4j.jar</icu4j.jar> <jsk-lib.jar>${deploy.lib}/jsk-lib.jar</jsk-lib.jar> - <jsk-platform.jar>${deploy.lib}jsk-platform.jar</jsk-platform.jar> + <jsk-platform.jar>${deploy.lib}/jsk-platform.jar</jsk-platform.jar> <log4j.jar>${deploy.lib}/log4j.jar</log4j.jar> <iris.jar>${deploy.lib}/iris.jar</iris.jar> <jgrapht.jar>${deploy.lib}/jgrapht.jar</jgrapht.jar> @@ -168,6 +170,13 @@ <slf4j.jar>${deploy.lib}/slf4j.jar</slf4j.jar> <nxparser.jar>${deploy.lib}/nxparser.jar</nxparser.jar> <zookeeper.jar>${deploy.lib}/zookeeper.jar</zookeeper.jar> + + + + <basedir>${deploy.dir}/testing</basedir> + + + </systemPropertyVariables> </configuration> </execution> Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/AbstractBTree.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/AbstractBTree.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/AbstractBTree.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -128,7 +128,6 @@ * </p> * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ * * @see KeyBuilder */ @@ -164,7 +163,7 @@ /** * Log for btree opeations. */ - protected static final Logger log = Logger.getLogger(AbstractBTree.class); + private static final Logger log = Logger.getLogger(AbstractBTree.class); /** * True iff the {@link #log} level is INFO or less. @@ -338,7 +337,6 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> - * @version $Id$ */ static class ChildMemoizer extends Memoizer<LoadChildRequest/* request */, AbstractNode<?>/* child */> { @@ -1362,7 +1360,6 @@ * Static class since must be {@link Serializable}. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ static final class TransientResourceMetadata implements IResourceMetadata { @@ -2588,6 +2585,7 @@ } + //fko ===== needs generic type ===== final public ITupleIterator rangeIterator() { return rangeIterator(null, null); @@ -2602,6 +2600,7 @@ * @param toKey * @return */ + //fko ===== needs generic type ===== final public ITupleIterator rangeIterator(Object fromKey, Object toKey) { fromKey = fromKey == null ? null : metadata.getTupleSerializer() @@ -2614,6 +2613,7 @@ } + //fko ===== needs generic type ===== final public ITupleIterator rangeIterator(byte[] fromKey, byte[] toKey) { return rangeIterator(fromKey, toKey, 0/* capacity */, @@ -2665,6 +2665,7 @@ * @param toKey * @return */ + //fko ===== needs generic type ===== final public ITupleIterator rangeIterator(Object fromKey, Object toKey, final int capacity,// final int flags,// @@ -2705,208 +2706,13 @@ * @todo add support to the iterator construct for filtering by a tuple * revision timestamp range. */ - public ITupleIterator rangeIterator(// - final byte[] fromKey,// - final byte[] toKey,// - final int capacityIsIgnored,// - final int flags,// - final IFilterConstructor filter// - ) { + //fko ===== needs generic type ===== + abstract public ITupleIterator rangeIterator(final byte[] fromKey, + final byte[] toKey, + final int capacityIsIgnored, + final int flags, + final IFilterConstructor filter); -// btreeCounters.nrangeIterator.incrementAndGet(); - - /* - * Does the iterator declare that it will not write back on the index? - */ - final boolean readOnly = ((flags & IRangeQuery.READONLY) != 0); - - if (readOnly && ((flags & IRangeQuery.REMOVEALL) != 0)) { - - throw new IllegalArgumentException(); - - } - - /* - * Note: this does not work out since it is not so easy to determine when - * the iterator is a point test as toKey is the exclusive upper bound. - */ -// * Note: this method will automatically apply the optional bloom filter to -// * reject range iterator requests that correspond to a point test. However -// * this can only be done when the fromKey and toKey are both non-null and -// * equals and further when the iterator was not requested with any options -// * that would permit concurrent modification of the index. -// if (isBloomFilter() -// && fromKey != null -// && toKey != null -// && (readOnly || (((flags & REMOVEALL) == 0) && ((flags & CURSOR) == 0))) -// && BytesUtil.bytesEqual(fromKey, toKey)) { -// -// /* -// * Do a fast rejection test using the bloom filter. -// */ -// if(!getBloomFilter().contains(fromKey)) { -// -// /* -// * The key is known to not be in the index so return an empty -// * iterator. -// */ -// return EmptyTupleIterator.INSTANCE; -// -// } -// -// /* -// * Since the bloom filter accepts the key we fall through into the -// * normal iterator logic. Using this code path is still possible -// * that the filter gave us a false positive and that the key is not -// * (in fact) in the index. Either way, the logic below will sort -// * things out. -// */ -// -// } - - /* - * Figure out what base iterator implementation to use. We will layer - * on the optional filter(s) below. - */ - ITupleIterator src; - - if ((this instanceof BTree) && ((flags & REVERSE) == 0) - && ((flags & REMOVEALL) == 0) && ((flags & CURSOR) == 0)) { - - /* - * Use the recursion-based striterator since it is faster for a - * BTree (but not for an IndexSegment). - * - * Note: The recursion-based striterator does not support remove()! - * - * @todo we could pass in the Tuple here to make the APIs a bit more - * consistent across the recursion-based and the cursor based - * iterators. - * - * @todo when the capacity is one and REVERSE is specified then we - * can optimize this using a reverse traversal striterator - this - * will have lower overhead than the cursor for the BTree (but not - * for an IndexSegment). - */ - -// src = fastForwardIterator(fromKey, toKey, capacity, flags); - - src = getRoot().rangeIterator(fromKey, toKey, flags); - - } else { - - final Tuple tuple = new Tuple(this, flags); - - if (this instanceof IndexSegment) { - - final IndexSegment seg = (IndexSegment) this; - - /* - * @todo we could scan the list of pools and chose the best fit - * pool and then allocate a buffer from that pool. Best fit - * would mean either the byte range fits without "too much" slop - * or the #of reads will have to perform is not too large. We - * might also want to limit the maximum size of the reads. - */ - -// final DirectBufferPool pool = DirectBufferPool.INSTANCE_10M; - final DirectBufferPool pool = DirectBufferPool.INSTANCE; - - if (true - && ((flags & REVERSE) == 0) - && ((flags & CURSOR) == 0) - && (seg.getStore().getCheckpoint().maxNodeOrLeafLength <= pool - .getBufferCapacity()) - && ((rangeCount(fromKey, toKey) / branchingFactor) > 2)) { - - src = new IndexSegmentMultiBlockIterator(seg, pool, - fromKey, toKey, flags); - - } else { - - src = new IndexSegmentTupleCursor(seg, tuple, fromKey, - toKey); - - } - - } else if (this instanceof BTree) { - - if (isReadOnly()) { - - // Note: this iterator does not allow removal. - src = new ReadOnlyBTreeTupleCursor(((BTree) this), tuple, - fromKey, toKey); - - } else { - - // Note: this iterator supports traversal with concurrent - // modification. - src = new MutableBTreeTupleCursor(((BTree) this), - new Tuple(this, flags), fromKey, toKey); - - } - - } else { - - throw new UnsupportedOperationException( - "Unknown B+Tree implementation: " - + this.getClass().getName()); - - } - - if ((flags & REVERSE) != 0) { - - /* - * Reverse scan iterator. - * - * Note: The reverse scan MUST be layered directly over the - * ITupleCursor. Most critically, REMOVEALL combined with a - * REVERSE scan needs to process the tuples in reverse index - * order and then delete them as it goes. - */ - - src = new Reverserator((ITupleCursor) src); - - } - - } - - if (filter != null) { - - /* - * Apply the optional filter. - * - * Note: This needs to be after the reverse scan and before - * REMOVEALL (those are the assumptions for the flags). - */ - - src = filter.newInstance(src); - - } - - if ((flags & REMOVEALL) != 0) { - - assertNotReadOnly(); - - /* - * Note: This iterator removes each tuple that it visits from the - * source iterator. - */ - - src = new TupleRemover() { - @Override - protected boolean remove(ITuple e) { - // remove all visited tuples. - return true; - } - }.filter(src); - - } - - return src; - - } - /** * Copy all data, including deleted index entry markers and timestamps iff * supported by the source and target. The goal is an exact copy of the data @@ -3893,7 +3699,6 @@ * {@link Reference} (a runtime security manager exception will result). * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ * * @param <T> */ Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/BTree.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/BTree.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/BTree.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -32,9 +32,13 @@ import com.bigdata.BigdataStatics; import com.bigdata.btree.AbstractBTreeTupleCursor.MutableBTreeTupleCursor; +import com.bigdata.btree.AbstractBTreeTupleCursor.ReadOnlyBTreeTupleCursor; import com.bigdata.btree.Leaf.ILeafListener; import com.bigdata.btree.data.ILeafData; import com.bigdata.btree.data.INodeData; +import com.bigdata.btree.filter.IFilterConstructor; +import com.bigdata.btree.filter.Reverserator; +import com.bigdata.btree.filter.TupleRemover; import com.bigdata.journal.AbstractJournal; import com.bigdata.journal.ICommitter; import com.bigdata.journal.IIndexManager; @@ -42,6 +46,7 @@ import com.bigdata.journal.Name2Addr.Entry; import com.bigdata.mdi.IResourceMetadata; import com.bigdata.rawstore.IRawStore; +import org.apache.log4j.Logger; /** * <p> @@ -151,10 +156,14 @@ * several published papers. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public class BTree extends AbstractBTree implements ICommitter, ILocalBTreeView { + /** + * Log for btree operations. + */ + private static final Logger log = Logger.getLogger(BTree.class); + final public int getHeight() { return height; @@ -188,6 +197,7 @@ } + @Override public final IResourceMetadata[] getResourceMetadata() { //override to make final so sub-classes cannot modify behavior. return super.getResourceMetadata(); @@ -204,23 +214,23 @@ */ public ICounter getCounter() { - ICounter counter = new Counter(this); + ICounter tmpCounter = new Counter(this); final LocalPartitionMetadata pmd = metadata.getPartitionMetadata(); if (pmd != null) { - counter = new PartitionedCounter(pmd.getPartitionId(), counter); + tmpCounter = new PartitionedCounter(pmd.getPartitionId(), tmpCounter); } if (isReadOnly()) { - return new ReadOnlyCounter(counter); + return new ReadOnlyCounter(tmpCounter); } - return counter; + return tmpCounter; } @@ -393,7 +403,7 @@ * <p> * Note: The {@link #getCounter()} is NOT changed by this method. */ - final private void newRootLeaf() { + private void newRootLeaf() { height = 0; @@ -1339,14 +1349,8 @@ // view of this BTree. newResources[1] = new JournalMetadata((AbstractJournal) getStore(), priorCommitTime); + System.arraycopy(oldResources, 1, newResources, 2, oldResources.length - 1); - // any other stores in the view are copied. - for (int i = 1; i < oldResources.length; i++) { - - newResources[i + 1] = oldResources[i]; - - } - final LocalPartitionMetadata newPmd = new LocalPartitionMetadata( oldPmd.getPartitionId(), // partitionId -1, // sourcePartitionId @@ -1567,7 +1571,6 @@ * @throws IllegalArgumentException * if store is <code>null</code>. */ - @SuppressWarnings("unchecked") public static BTree load(final IRawStore store, final long addrCheckpoint, final boolean readOnly) { @@ -1653,6 +1656,147 @@ } /** + * Core implementation. + * <p> + * Note: If {@link IRangeQuery#CURSOR} is specified the returned iterator + * supports traversal with concurrent modification by a single-threaded + * process (the {@link BTree} is NOT thread-safe for writers). Write are + * permitted iff {@link AbstractBTree} allows writes. + * <p> + * Note: {@link IRangeQuery#REVERSE} is handled here by wrapping the + * underlying {@link ITupleCursor}. + * <p> + * Note: {@link IRangeQuery#REMOVEALL} is handled here by wrapping the + * iterator. + * <p> + * Note: + * {@link FusedView#rangeIterator(byte[], byte[], int, int, IFilterConstructor)} + * is also responsible for constructing an {@link ITupleIterator} in a + * manner similar to this method. If you are updating the logic here, then + * check the logic in that method as well! + * + * @todo add support to the iterator construct for filtering by a tuple + * revision timestamp range. + */ + public ITupleIterator rangeIterator(// + final byte[] fromKey,// + final byte[] toKey,// + final int capacityIsIgnored,// + final int flags,// + final IFilterConstructor filter// + ) { + + /* + * Does the iterator declare that it will not write back on the index? + */ + final boolean ro = ((flags & IRangeQuery.READONLY) != 0); + + if (ro && ((flags & IRangeQuery.REMOVEALL) != 0)) { + + throw new IllegalArgumentException(); + + } + + /* + * Figure out what base iterator implementation to use. We will layer + * on the optional filter(s) below. + */ + ITupleIterator src; + + if (((flags & REVERSE) == 0) && + ((flags & REMOVEALL) == 0) && + ((flags & CURSOR) == 0)) { + + /* + * Use the recursion-based striterator since it is faster for a + * BTree (but not for an IndexSegment). + * + * Note: The recursion-based striterator does not support remove()! + * + * @todo we could pass in the Tuple here to make the APIs a bit more + * consistent across the recursion-based and the cursor based + * iterators. + * + * @todo when the capacity is one and REVERSE is specified then we + * can optimize this using a reverse traversal striterator - this + * will have lower overhead than the cursor for the BTree (but not + * for an IndexSegment). + */ + src = getRoot().rangeIterator(fromKey, toKey, flags); + + } else { + + final Tuple tuple = new Tuple(this, flags); + + if (isReadOnly()) { + + // Note: this iterator does not allow removal. + src = new ReadOnlyBTreeTupleCursor(((BTree) this), tuple, + fromKey, toKey); + + } else { + + // Note: this iterator supports traversal with concurrent + // modification. + src = new MutableBTreeTupleCursor(((BTree) this), + new Tuple(this, flags), fromKey, toKey); + + } + + if ((flags & REVERSE) != 0) { + + /* + * Reverse scan iterator. + * + * Note: The reverse scan MUST be layered directly over the + * ITupleCursor. Most critically, REMOVEALL combined with a + * REVERSE scan needs to process the tuples in reverse index + * order and then delete them as it goes. + */ + + src = new Reverserator((ITupleCursor) src); + + } + + } + + if (filter != null) { + + /* + * Apply the optional filter. + * + * Note: This needs to be after the reverse scan and before + * REMOVEALL (those are the assumptions for the flags). + */ + + src = filter.newInstance(src); + + } + + if ((flags & REMOVEALL) != 0) { + + assertNotReadOnly(); + + /* + * Note: This iterator removes each tuple that it visits from the + * source iterator. + */ + + src = new TupleRemover() { + @Override + protected boolean remove(ITuple e) { + // remove all visited tuples. + return true; + } + }.filter(src); + + } + + return src; + + } + + /** * Factory for mutable nodes and leaves used by the {@link NodeSerializer}. */ protected static class NodeFactory implements INodeFactory { @@ -1682,7 +1826,6 @@ * Mutable counter. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public static class Counter implements ICounter { @@ -1742,7 +1885,6 @@ * int32 word. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public static class PartitionedCounter implements ICounter { @@ -1851,7 +1993,6 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> - * @version $Id$ */ protected static class Stack { @@ -2027,7 +2168,6 @@ * Note: The {@link MutableBTreeTupleCursor} does register such listeners. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public class LeafCursor implements ILeafCursor<Leaf> { @@ -2125,6 +2265,7 @@ } + @Override public LeafCursor clone() { return new LeafCursor(this); @@ -2177,7 +2318,7 @@ } - public Leaf first() { + final public Leaf first() { stack.clear(); @@ -2198,7 +2339,7 @@ } - public Leaf last() { + final public Leaf last() { stack.clear(); @@ -2224,7 +2365,7 @@ * the leaf may not actually contain the key, in which case it is the * leaf that contains the insertion point for the key. */ - public Leaf seek(final byte[] key) { + final public Leaf seek(final byte[] key) { stack.clear(); Deleted: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/DelegateIndex.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/DelegateIndex.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/DelegateIndex.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -1,169 +0,0 @@ -/* - -Copyright (C) SYSTAP, LLC 2006-2008. All rights reserved. - -Contact: - SYSTAP, LLC - 4501 Tower Road - Greensboro, NC 27410 - lic...@bi... - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ -/* - * Created on Feb 20, 2008 - */ - -package com.bigdata.btree; - -import com.bigdata.btree.filter.IFilterConstructor; -import com.bigdata.btree.proc.AbstractKeyArrayIndexProcedureConstructor; -import com.bigdata.btree.proc.IKeyRangeIndexProcedure; -import com.bigdata.btree.proc.IResultHandler; -import com.bigdata.btree.proc.ISimpleIndexProcedure; -import com.bigdata.counters.ICounterSet; -import com.bigdata.mdi.IResourceMetadata; - -/** - * An object that delegates its {@link IIndex} interface. - * - * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ - */ -public class DelegateIndex implements IIndex { - - private final IIndex delegate; - - /** - * @param delegate - * The delegate. - */ - public DelegateIndex(IIndex delegate) { - - if (delegate == null) { - - throw new IllegalArgumentException(); - - } - - this.delegate = delegate; - - } - - public String toString() { - - final StringBuilder sb = new StringBuilder(); - - sb.append(getClass().getSimpleName()); - - sb.append("{ "); - - sb.append(delegate.toString()); - - sb.append("}"); - - return sb.toString(); - - } - - public boolean contains(byte[] key) { - return delegate.contains(key); - } - - public ICounter getCounter() { - return delegate.getCounter(); - } - - public IndexMetadata getIndexMetadata() { - return delegate.getIndexMetadata(); - } - - public IResourceMetadata[] getResourceMetadata() { - return delegate.getResourceMetadata(); - } - - public ICounterSet getCounters() { - return delegate.getCounters(); - } - - public byte[] insert(byte[] key, byte[] value) { - return delegate.insert(key, value); - } - - public byte[] lookup(byte[] key) { - return delegate.lookup(key); - } - - public long rangeCount() { - return delegate.rangeCount(); - } - - public long rangeCount(byte[] fromKey, byte[] toKey) { - return delegate.rangeCount(fromKey, toKey); - } - - public long rangeCountExact(byte[] fromKey, byte[] toKey) { - return delegate.rangeCountExact(fromKey, toKey); - } - - public long rangeCountExactWithDeleted(byte[] fromKey, byte[] toKey) { - return delegate.rangeCountExactWithDeleted(fromKey, toKey); - } - - public ITupleIterator rangeIterator() { - return rangeIterator(null,null); - } - - public ITupleIterator rangeIterator(byte[] fromKey, byte[] toKey, int capacity, int flags, IFilterConstructor filter) { - return delegate.rangeIterator(fromKey, toKey, capacity, flags, filter); - } - - public ITupleIterator rangeIterator(byte[] fromKey, byte[] toKey) { - return delegate.rangeIterator(fromKey, toKey); - } - - public byte[] remove(byte[] key) { - return delegate.remove(key); - } - - public Object submit(byte[] key, ISimpleIndexProcedure proc) { - return delegate.submit(key, proc); - } - - public void submit(byte[] fromKey, byte[] toKey, IKeyRangeIndexProcedure proc, IResultHandler handler) { - delegate.submit(fromKey, toKey, proc, handler); - } - - public void submit(int fromIndex, int toIndex, byte[][] keys, byte[][] vals, AbstractKeyArrayIndexProcedureConstructor ctor, IResultHandler handler) { - delegate.submit(fromIndex, toIndex, keys, vals, ctor, handler); - } - - public boolean contains(Object key) { - return delegate.contains(key); - } - - public Object insert(Object key, Object value) { - return delegate.insert(key, value); - } - - public Object lookup(Object key) { - return delegate.lookup(key); - } - - public Object remove(Object key) { - return delegate.remove(key); - } - -} Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegment.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegment.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegment.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -29,15 +29,20 @@ import com.bigdata.btree.IndexSegment.ImmutableNodeFactory.ImmutableLeaf; import com.bigdata.btree.data.ILeafData; import com.bigdata.btree.data.INodeData; +import com.bigdata.btree.filter.IFilterConstructor; +import com.bigdata.btree.filter.Reverserator; +import com.bigdata.btree.filter.TupleRemover; import com.bigdata.btree.raba.IRaba; import com.bigdata.btree.raba.ReadOnlyKeysRaba; import com.bigdata.btree.raba.ReadOnlyValuesRaba; import com.bigdata.io.AbstractFixedByteArrayBuffer; +import com.bigdata.io.DirectBufferPool; import com.bigdata.io.FixedByteArrayBuffer; import com.bigdata.mdi.IResourceMetadata; import com.bigdata.service.Event; import com.bigdata.service.EventResource; import com.bigdata.service.EventType; +import org.apache.log4j.Logger; /** * An index segment is read-only btree corresponding to some key range of a @@ -51,11 +56,15 @@ * leaves will all refuse mutation operations). * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public class IndexSegment extends AbstractBTree { /** + * Log for btree opeations. + */ + private static final Logger log = Logger.getLogger(IndexSegment.class); + + /** * Type safe reference to the backing store. */ private final IndexSegmentStore fileStore; @@ -160,6 +169,7 @@ * {@link #getEntryCount()} uses the {@link IndexSegmentCheckpoint} and that * is only available while the {@link IndexSegmentStore} is open. */ + @Override public String toString() { // make sure the fileStore will remain open. @@ -303,7 +313,7 @@ } @Override - protected void _reopen() { + final protected void _reopen() { // prevent concurrent close. fileStore.lock.lock(); @@ -684,6 +694,138 @@ }; } + /** + * Core implementation. + * <p> + * Note: If {@link IRangeQuery#CURSOR} is specified the returned iterator + * supports traversal with concurrent modification by a single-threaded + * process (the {@link BTree} is NOT thread-safe for writers). Write are + * permitted iff {@link AbstractBTree} allows writes. + * <p> + * Note: {@link IRangeQuery#REVERSE} is handled here by wrapping the + * underlying {@link ITupleCursor}. + * <p> + * Note: {@link IRangeQuery#REMOVEALL} is handled here by wrapping the + * iterator. + * <p> + * Note: + * {@link FusedView#rangeIterator(byte[], byte[], int, int, IFilterConstructor)} + * is also responsible for constructing an {@link ITupleIterator} in a + * manner similar to this method. If you are updating the logic here, then + * check the logic in that method as well! + * + * @todo add support to the iterator construct for filtering by a tuple + * revision timestamp range. + */ + public ITupleIterator rangeIterator(// + final byte[] fromKey,// + final byte[] toKey,// + final int capacityIsIgnored,// + final int flags,// + final IFilterConstructor filter// + ) { + + /* + * Does the iterator declare that it will not write back on the index? + */ + final boolean readOnly = ((flags & IRangeQuery.READONLY) != 0); + + if (readOnly && ((flags & IRangeQuery.REMOVEALL) != 0)) { + + throw new IllegalArgumentException(); + + } + + /* + * Figure out what base iterator implementation to use. We will layer + * on the optional filter(s) below. + */ + ITupleIterator src; + + final Tuple tuple = new Tuple(this, flags); + + final IndexSegment seg = (IndexSegment) this; + + /* + * @todo we could scan the list of pools and chose the best fit + * pool and then allocate a buffer from that pool. Best fit + * would mean either the byte range fits without "too much" slop + * or the #of reads will have to perform is not too large. We + * might also want to limit the maximum size of the reads. + */ + +// final DirectBufferPool pool = DirectBufferPool.INSTANCE_10M; + final DirectBufferPool pool = DirectBufferPool.INSTANCE; + + if (true + && ((flags & REVERSE) == 0) + && ((flags & CURSOR) == 0) + && (seg.getStore().getCheckpoint().maxNodeOrLeafLength <= pool + .getBufferCapacity()) + && ((rangeCount(fromKey, toKey) / branchingFactor) > 2)) { + + src = new IndexSegmentMultiBlockIterator(seg, pool, + fromKey, toKey, flags); + + } else { + + src = new IndexSegmentTupleCursor(seg, tuple, fromKey, toKey); + + } + + + if ((flags & REVERSE) != 0) { + + /* + * Reverse scan iterator. + * + * Note: The reverse scan MUST be layered directly over the + * ITupleCursor. Most critically, REMOVEALL combined with a + * REVERSE scan needs to process the tuples in reverse index + * order and then delete them as it goes. + */ + + src = new Reverserator((ITupleCursor) src); + + } + + + if (filter != null) { + + /* + * Apply the optional filter. + * + * Note: This needs to be after the reverse scan and before + * REMOVEALL (those are the assumptions for the flags). + */ + + src = filter.newInstance(src); + + } + + if ((flags & REMOVEALL) != 0) { + + assertNotReadOnly(); + + /* + * Note: This iterator removes each tuple that it visits from the + * source iterator. + */ + + src = new TupleRemover() { + @Override + protected boolean remove(ITuple e) { + // remove all visited tuples. + return true; + } + }.filter(src); + + } + + return src; + + } + /* * INodeFactory */ @@ -719,7 +861,6 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> - * @version $Id$ */ public static class ImmutableNode extends Node { @@ -768,8 +909,6 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> - * @version $Id: IndexSegment.java 2265 2009-10-26 12:51:06Z thompsonbry - * $ */ private static class EmptyReadOnlyLeafData implements ILeafData { @@ -869,7 +1008,6 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> - * @version $Id$ */ public static class ImmutableLeaf extends Leaf { @@ -1007,7 +1145,6 @@ // * // * @author <a href="mailto:tho...@us...">Bryan // * Thompson</a> -// * @version $Id$ // */ // static public class ImmutableEmptyLastLeaf extends ImmutableLeaf { // @@ -1046,7 +1183,6 @@ * A position for the {@link IndexSegmentTupleCursor}. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ * @param <E> * The generic type for objects de-serialized from the values in * the index. @@ -1054,6 +1190,7 @@ static private class CursorPosition<E> extends AbstractCursorPosition<ImmutableLeaf,E> { @SuppressWarnings("unchecked") + @Override public IndexSegmentTupleCursor<E> getCursor() { return (IndexSegmentTupleCursor)cursor; @@ -1102,7 +1239,6 @@ * listeners for concurrent modifications. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ * @param <E> * The generic type for the objects de-serialized from the index. */ @@ -1265,7 +1401,6 @@ * Cursor using the double-linked leaves for efficient scans. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public class ImmutableLeafCursor implements ILeafCursor<ImmutableLeaf> { @@ -1283,6 +1418,7 @@ } + @Override public ImmutableLeafCursor clone() { return new ImmutableLeafCursor(this); @@ -1333,7 +1469,7 @@ } - public ImmutableLeaf seek(final byte[] key) { + final public ImmutableLeaf seek(final byte[] key) { leaf = findLeaf(key); @@ -1363,7 +1499,7 @@ } - public ImmutableLeaf first() { + final public ImmutableLeaf first() { final long addr = getStore().getCheckpoint().addrFirstLeaf; @@ -1373,7 +1509,7 @@ } - public ImmutableLeaf last() { + final public ImmutableLeaf last() { final long addr = getStore().getCheckpoint().addrLastLeaf; Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndex.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndex.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndex.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -29,13 +29,13 @@ import java.io.ObjectOutput; import java.util.UUID; -import com.bigdata.mdi.PartitionLocator; import org.CognitiveWeb.extser.LongPacker; import com.bigdata.btree.keys.IKeyBuilderFactory; import com.bigdata.btree.view.FusedView; import com.bigdata.journal.ICommitter; import com.bigdata.journal.IResourceManager; +import com.bigdata.mdi.PartitionLocator; import com.bigdata.rawstore.IRawStore; import com.bigdata.service.MetadataService; @@ -44,7 +44,7 @@ * metadata index for each distributed index. The keys of the metadata index are * the first key that would be directed into the corresponding index segment, * e.g., a <em>separator key</em> (this is just the standard btree semantics). - * The values are serialized {@link com.bigdata.mdi.PartitionLocator} objects. + * The values are serialized {@link PartitionLocator} objects. * <p> * Note: At this time the recommended scale-out approach for the metadata index * is to place the metadata indices on a {@link MetadataService} (the same @@ -63,7 +63,6 @@ * taking the database offline. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ * * @todo The {@link MetadataIndex} does NOT support either overflow (it may NOT * be a {@link FusedView}) NOR key-range splits. There are several issues @@ -97,6 +96,7 @@ */ private transient final MetadataIndexView view; + @Override public MetadataIndexMetadata getIndexMetadata() { return (MetadataIndexMetadata) super.getIndexMetadata(); @@ -210,6 +210,7 @@ * Extended to require a checkpoint if {@link #incrementAndGetNextPartitionId()} has been * invoked. */ + @Override public boolean needsCheckpoint() { if(nextPartitionId != ((MetadataIndexCheckpoint)getCheckpoint()).getNextPartitionId()) { @@ -227,7 +228,6 @@ * identifier to be assigned by the metadata index. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public static class MetadataIndexCheckpoint extends Checkpoint { @@ -329,7 +329,6 @@ * for the managed scale-out index. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public static class MetadataIndexMetadata extends IndexMetadata implements Externalizable { @@ -381,6 +380,7 @@ private static final transient int VERSION0 = 0x0; + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { @@ -398,6 +398,7 @@ } + @Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); @@ -430,7 +431,6 @@ * {@link MetadataIndex}. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public static class PartitionLocatorTupleSerializer extends DefaultTupleSerializer<byte[]/*key*/, PartitionLocator/*val*/> { @@ -473,6 +473,7 @@ */ private final static transient byte VERSION = VERSION0; + @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { @@ -490,6 +491,7 @@ } + @Override public void writeExternal(final ObjectOutput out) throws IOException { super.writeExternal(out); Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndexView.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndexView.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndexView.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -28,27 +28,27 @@ package com.bigdata.btree; -import com.bigdata.mdi.PartitionLocator; +import com.bigdata.btree.MetadataIndex.MetadataIndexMetadata; +import com.bigdata.btree.filter.IFilterConstructor; import org.apache.log4j.Logger; import com.bigdata.cache.LRUCache; -import com.bigdata.btree.MetadataIndex.MetadataIndexMetadata; +import com.bigdata.mdi.PartitionLocator; /** * The extension semantics for the {@link IMetadataIndex} are implemented by * this class. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ -public class MetadataIndexView extends DelegateIndex implements IMetadataIndex { +public class MetadataIndexView implements IMetadataIndex { protected static final Logger log = Logger.getLogger(MetadataIndexView.class); // protected static final boolean INFO = log.isInfoEnabled(); // protected static final boolean DEBUG = log.isDebugEnabled(); - private final AbstractBTree delegate; + private final MetadataIndex metadataIndex; /** * <code>true</code> iff this is a read-only view. this is used to @@ -58,19 +58,14 @@ */ final private boolean readOnly; - public MetadataIndexView(AbstractBTree delegate) { - - super(delegate); - - this.delegate = delegate; - - this.readOnly = delegate.isReadOnly(); - + public MetadataIndexView(MetadataIndex metadataIndex) { + this.metadataIndex = metadataIndex; + this.readOnly = metadataIndex.isReadOnly(); } public MetadataIndexMetadata getIndexMetadata() { - return (MetadataIndexMetadata) super.getIndexMetadata(); + return (MetadataIndexMetadata) metadataIndex.getIndexMetadata(); } @@ -87,7 +82,7 @@ * de-serialization using the ITupleSerializer. */ - return (PartitionLocator) delegate.lookup((Object) key); + return (PartitionLocator) metadataIndex.lookup((Object) key); } @@ -112,7 +107,7 @@ */ private PartitionLocator find_with_iterator(byte[] key) { - final ITupleIterator<PartitionLocator> itr = delegate.rangeIterator( + final ITupleIterator<PartitionLocator> itr = metadataIndex.rangeIterator( null/* fromKey */, key/* toKey */, 1/* capacity */, IRangeQuery.VALS | IRangeQuery.REVERSE, null/* filter */); @@ -147,7 +142,7 @@ if (key == null) { // use the index of the last partition. - index = delegate.getEntryCount() - 1; + index = metadataIndex.getEntryCount() - 1; } else { @@ -212,7 +207,7 @@ /** * Remove the locator from the {@link #locatorCache}. It will be re-read on - * demand from the {@link #delegate}. + * demand from the {@link #metadataIndex}. */ public void staleLocator(PartitionLocator locator) { @@ -230,8 +225,8 @@ */ private PartitionLocator getLocatorAtIndex(int index) { - final ITuple<PartitionLocator> tuple = delegate.valueAt(index, - delegate.getLookupTuple()); + final ITuple<PartitionLocator> tuple = metadataIndex.valueAt(index, + metadataIndex.getLookupTuple()); return tuple.getObject(); @@ -252,7 +247,7 @@ */ private int findIndexOf(byte[] key) { - int pos = delegate.indexOf(key); + int pos = metadataIndex.indexOf(key); if (pos < 0) { @@ -266,7 +261,7 @@ if(pos == 0) { - if(delegate.getEntryCount() != 0) { + if(metadataIndex.getEntryCount() != 0) { throw new IllegalStateException( "Partition not defined for empty key."); @@ -294,4 +289,34 @@ } + public long rangeCount() { + return metadataIndex.rangeCount(); + } + + public long rangeCount(byte[] fromKey, byte[] toKey) { + return metadataIndex.rangeCount(fromKey, toKey); + } + + public long rangeCountExact(byte[] fromKey, byte[] toKey) { + return metadataIndex.rangeCountExact(fromKey, toKey); + } + + public long rangeCountExactWithDeleted(byte[] fromKey, byte[] toKey) { + return metadataIndex.rangeCountExactWithDeleted(fromKey, toKey); + } + + public ITupleIterator rangeIterator() { + return metadataIndex.rangeIterator(); + } + + public ITupleIterator rangeIterator(byte[] fromKey, byte[] toKey) { + return metadataIndex.rangeIterator(fromKey, toKey); + } + + public ITupleIterator rangeIterator(byte[] fromKey, byte[] toKey, + int capacity, int flags, + IFilterConstructor filterCtor) { + return metadataIndex.rangeIterator(fromKey, toKey, capacity, flags, filterCtor); + } + } Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/Node.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/Node.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/Node.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -56,6 +56,7 @@ import cutthecrap.utils.striterators.Expander; import cutthecrap.utils.striterators.SingleValueIterator; import cutthecrap.utils.striterators.Striterator; +import org.apache.log4j.Logger; /** * <p> @@ -82,11 +83,15 @@ * we can prune the search before we materialize the child. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ public class Node extends AbstractNode<Node> implements INodeData { /** + * Log for btree opeations. + */ + private static final Logger log = Logger.getLogger(Node.class); + + /** * The data record. {@link MutableNodeData} is used for all mutation * operations. {@link ReadOnlyNodeData} is used when the {@link Node} is * made persistent. A read-only data record is automatically converted into @@ -623,7 +628,7 @@ btree.getBtreeCounters().rootsSplit++; - if (BTree.log.isInfoEnabled() || BigdataStatics.debug) { + if (log.isInfoEnabled() || BigdataStatics.debug) { // Note: nnodes and nleaves might not reflect rightSibling yet. @@ -632,8 +637,8 @@ + ", m=" + btree.getBranchingFactor() + ", nentries=" + btree.nentries; - if (BTree.log.isInfoEnabled()) - BTree.log.info(msg); + if (log.isInfoEnabled()) + log.info(msg); if (BigdataStatics.debug) System.err.println(msg); @@ -2400,8 +2405,8 @@ // one less node in the tree. btree.nnodes--; - if (BTree.INFO) { - BTree.log.info("reduced tree height: height=" + if (INFO) { + log.info("reduced tree height: height=" + btree.height + ", newRoot=" + btree.root); } Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/ReadOnlyIndex.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/ReadOnlyIndex.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/ReadOnlyIndex.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -27,6 +27,9 @@ package com.bigdata.btree; +import com.bigdata.btree.proc.IKeyRangeIndexProcedure; +import com.bigdata.btree.proc.ISimpleIndexProcedure; +import com.bigdata.counters.ICounterSet; import java.util.Iterator; import com.bigdata.btree.filter.IFilterConstructor; @@ -47,20 +50,19 @@ * @see {@link IResourceManager#getIndex(String, long)} * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ */ -public class ReadOnlyIndex extends DelegateIndex { +public class ReadOnlyIndex implements IIndex { + + private IIndex src; public ReadOnlyIndex(IIndex src) { - - super(src); - + this.src = src; } /** {@link IndexMetadata} is cloned to disallow modification. */ final public IndexMetadata getIndexMetadata() { - return super.getIndexMetadata().clone(); + return src.getIndexMetadata().clone(); } @@ -71,7 +73,7 @@ */ final public IResourceMetadata[] getResourceMetadata() { - return super.getResourceMetadata().clone(); + return src.getResourceMetadata().clone(); } @@ -80,7 +82,7 @@ */ final public ICounter getCounter() { - return new ReadOnlyCounter(super.getCounter()); + return new ReadOnlyCounter(src.getCounter()); } @@ -121,7 +123,7 @@ /* * Must explicitly disable Iterator#remove(). */ - return new ReadOnlyEntryIterator(super.rangeIterator(fromKey, toKey, + return new ReadOnlyEntryIterator(src.rangeIterator(fromKey, toKey, capacity, flags, filter)); } @@ -173,4 +175,65 @@ } + public ICounterSet getCounters() { + return src.getCounters(); + } + + public Object submit(byte[] key, ISimpleIndexProcedure proc) { + return src.submit(key, proc); + } + + public void submit(byte[] fromKey, byte[] toKey, + IKeyRangeIndexProcedure proc, IResultHandler handler) { + src.submit(fromKey, toKey, proc, handler); + } + + public byte[] lookup(byte[] key) { + return src.lookup(key); + } + + public boolean contains(byte[] key) { + return src.contains(key); + } + + public Object insert(Object key, Object value) { + return src.insert(key, value); + } + + public Object lookup(Object key) { + return src.lookup(key); + } + + public boolean contains(Object key) { + return src.contains(key); + } + + public Object remove(Object key) { + return src.remove(key); + } + + public long rangeCount() { + return src.rangeCount(); + } + + public long rangeCount(byte[] fromKey, byte[] toKey) { + return src.rangeCount(fromKey, toKey); + } + + public long rangeCountExact(byte[] fromKey, byte[] toKey) { + return src.rangeCountExact(fromKey, toKey); + } + + public long rangeCountExactWithDeleted(byte[] fromKey, byte[] toKey) { + return src.rangeCountExactWithDeleted(fromKey, toKey); + } + + public ITupleIterator rangeIterator() { + return src.rangeIterator(); + } + + public ITupleIterator rangeIterator(byte[] fromKey, byte[] toKey) { + return src.rangeIterator(fromKey, toKey); + } + } Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/HardReferenceGlobalLRURecycler.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/HardReferenceGlobalLRURecycler.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/HardReferenceGlobalLRURecycler.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -613,6 +613,7 @@ e.prior = last; last = e; } + //System.err.println("++size"); size++; counters.bytesInMemory.addAndGet(e.bytesInMemory); counters.bytesOnDisk.addAndGet(e.bytesOnDisk); @@ -654,6 +655,7 @@ e.cache = null; // clear reference to the cache. e.k = null; // clear the key. e.v = null; // clear the value reference. + //System.err.println("--size"); size--; counters.bytesInMemory.addAndGet(-e.bytesInMemory); counters.bytesOnDisk.addAndGet(-e.bytesOnDisk); Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/LRUNexus.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/LRUNexus.java 2010-10-08 19:57:43 UTC (rev 3760) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/LRUNexus.java 2010-10-08 22:21:56 UTC (rev 3761) @@ -47,7 +47,6 @@ * system properties defined by {@link Options}. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> - * @version $Id$ * * FIXME LR... [truncated message content] |