From: <fko...@us...> - 2010-10-14 20:44:56
|
Revision: 3801 http://bigdata.svn.sourceforge.net/bigdata/?rev=3801&view=rev Author: fkoliver Date: 2010-10-14 20:44:47 +0000 (Thu, 14 Oct 2010) Log Message: ----------- Revert r3761 which changed some subclasses of BTree into uses of BTree. 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/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 Removed Paths: ------------- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/EventBTree.java Modified: branches/maven_scaleout/bigdata-core/pom.xml =================================================================== --- branches/maven_scaleout/bigdata-core/pom.xml 2010-10-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/pom.xml 2010-10-14 20:44:47 UTC (rev 3801) @@ -60,8 +60,6 @@ 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> @@ -162,7 +160,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> 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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/AbstractBTree.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -128,6 +128,7 @@ * </p> * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ * * @see KeyBuilder */ @@ -163,7 +164,7 @@ /** * Log for btree opeations. */ - private static final Logger log = Logger.getLogger(AbstractBTree.class); + protected static final Logger log = Logger.getLogger(AbstractBTree.class); /** * True iff the {@link #log} level is INFO or less. @@ -337,6 +338,7 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> + * @version $Id$ */ static class ChildMemoizer extends Memoizer<LoadChildRequest/* request */, AbstractNode<?>/* child */> { @@ -1360,6 +1362,7 @@ * Static class since must be {@link Serializable}. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ */ static final class TransientResourceMetadata implements IResourceMetadata { @@ -2585,7 +2588,6 @@ } - //fko ===== needs generic type ===== final public ITupleIterator rangeIterator() { return rangeIterator(null, null); @@ -2600,7 +2602,6 @@ * @param toKey * @return */ - //fko ===== needs generic type ===== final public ITupleIterator rangeIterator(Object fromKey, Object toKey) { fromKey = fromKey == null ? null : metadata.getTupleSerializer() @@ -2613,7 +2614,6 @@ } - //fko ===== needs generic type ===== final public ITupleIterator rangeIterator(byte[] fromKey, byte[] toKey) { return rangeIterator(fromKey, toKey, 0/* capacity */, @@ -2665,7 +2665,6 @@ * @param toKey * @return */ - //fko ===== needs generic type ===== final public ITupleIterator rangeIterator(Object fromKey, Object toKey, final int capacity,// final int flags,// @@ -2706,13 +2705,208 @@ * @todo add support to the iterator construct for filtering by a tuple * revision timestamp range. */ - //fko ===== needs generic type ===== - abstract public ITupleIterator rangeIterator(final byte[] fromKey, - final byte[] toKey, - final int capacityIsIgnored, - final int flags, - final IFilterConstructor filter); + 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 @@ -3699,6 +3893,7 @@ * {@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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/BTree.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -32,13 +32,9 @@ 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; @@ -46,7 +42,6 @@ import com.bigdata.journal.Name2Addr.Entry; import com.bigdata.mdi.IResourceMetadata; import com.bigdata.rawstore.IRawStore; -import org.apache.log4j.Logger; /** * <p> @@ -156,14 +151,10 @@ * 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; @@ -197,7 +188,6 @@ } - @Override public final IResourceMetadata[] getResourceMetadata() { //override to make final so sub-classes cannot modify behavior. return super.getResourceMetadata(); @@ -214,23 +204,23 @@ */ public ICounter getCounter() { - ICounter tmpCounter = new Counter(this); + ICounter counter = new Counter(this); final LocalPartitionMetadata pmd = metadata.getPartitionMetadata(); if (pmd != null) { - tmpCounter = new PartitionedCounter(pmd.getPartitionId(), tmpCounter); + counter = new PartitionedCounter(pmd.getPartitionId(), counter); } if (isReadOnly()) { - return new ReadOnlyCounter(tmpCounter); + return new ReadOnlyCounter(counter); } - return tmpCounter; + return counter; } @@ -403,7 +393,7 @@ * <p> * Note: The {@link #getCounter()} is NOT changed by this method. */ - private void newRootLeaf() { + final private void newRootLeaf() { height = 0; @@ -1349,8 +1339,14 @@ // 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 @@ -1571,6 +1567,7 @@ * @throws IllegalArgumentException * if store is <code>null</code>. */ + @SuppressWarnings("unchecked") public static BTree load(final IRawStore store, final long addrCheckpoint, final boolean readOnly) { @@ -1656,147 +1653,6 @@ } /** - * 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 { @@ -1826,6 +1682,7 @@ * Mutable counter. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ */ public static class Counter implements ICounter { @@ -1885,6 +1742,7 @@ * int32 word. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ */ public static class PartitionedCounter implements ICounter { @@ -1993,6 +1851,7 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> + * @version $Id$ */ protected static class Stack { @@ -2168,6 +2027,7 @@ * 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> { @@ -2265,7 +2125,6 @@ } - @Override public LeafCursor clone() { return new LeafCursor(this); @@ -2318,7 +2177,7 @@ } - final public Leaf first() { + public Leaf first() { stack.clear(); @@ -2339,7 +2198,7 @@ } - final public Leaf last() { + public Leaf last() { stack.clear(); @@ -2365,7 +2224,7 @@ * the leaf may not actually contain the key, in which case it is the * leaf that contains the insertion point for the key. */ - final public Leaf seek(final byte[] key) { + public Leaf seek(final byte[] key) { stack.clear(); Copied: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/DelegateIndex.java (from rev 3760, 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 (rev 0) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/DelegateIndex.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -0,0 +1,169 @@ +/* + +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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/IndexSegment.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -29,20 +29,15 @@ 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 @@ -56,15 +51,11 @@ * 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; @@ -169,7 +160,6 @@ * {@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. @@ -313,7 +303,7 @@ } @Override - final protected void _reopen() { + protected void _reopen() { // prevent concurrent close. fileStore.lock.lock(); @@ -694,138 +684,6 @@ }; } - /** - * 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 */ @@ -861,6 +719,7 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> + * @version $Id$ */ public static class ImmutableNode extends Node { @@ -909,6 +768,8 @@ * * @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 { @@ -1008,6 +869,7 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> + * @version $Id$ */ public static class ImmutableLeaf extends Leaf { @@ -1145,6 +1007,7 @@ // * // * @author <a href="mailto:tho...@us...">Bryan // * Thompson</a> +// * @version $Id$ // */ // static public class ImmutableEmptyLastLeaf extends ImmutableLeaf { // @@ -1183,6 +1046,7 @@ * 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. @@ -1190,7 +1054,6 @@ static private class CursorPosition<E> extends AbstractCursorPosition<ImmutableLeaf,E> { @SuppressWarnings("unchecked") - @Override public IndexSegmentTupleCursor<E> getCursor() { return (IndexSegmentTupleCursor)cursor; @@ -1239,6 +1102,7 @@ * 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. */ @@ -1401,6 +1265,7 @@ * 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> { @@ -1418,7 +1283,6 @@ } - @Override public ImmutableLeafCursor clone() { return new ImmutableLeafCursor(this); @@ -1469,7 +1333,7 @@ } - final public ImmutableLeaf seek(final byte[] key) { + public ImmutableLeaf seek(final byte[] key) { leaf = findLeaf(key); @@ -1499,7 +1363,7 @@ } - final public ImmutableLeaf first() { + public ImmutableLeaf first() { final long addr = getStore().getCheckpoint().addrFirstLeaf; @@ -1509,7 +1373,7 @@ } - final public ImmutableLeaf last() { + 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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndex.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -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 PartitionLocator} objects. + * The values are serialized {@link com.bigdata.mdi.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,6 +63,7 @@ * 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 @@ -96,7 +97,6 @@ */ private transient final MetadataIndexView view; - @Override public MetadataIndexMetadata getIndexMetadata() { return (MetadataIndexMetadata) super.getIndexMetadata(); @@ -210,7 +210,6 @@ * Extended to require a checkpoint if {@link #incrementAndGetNextPartitionId()} has been * invoked. */ - @Override public boolean needsCheckpoint() { if(nextPartitionId != ((MetadataIndexCheckpoint)getCheckpoint()).getNextPartitionId()) { @@ -228,6 +227,7 @@ * 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,6 +329,7 @@ * 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 { @@ -380,7 +381,6 @@ private static final transient int VERSION0 = 0x0; - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { @@ -398,7 +398,6 @@ } - @Override public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); @@ -431,6 +430,7 @@ * {@link MetadataIndex}. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ */ public static class PartitionLocatorTupleSerializer extends DefaultTupleSerializer<byte[]/*key*/, PartitionLocator/*val*/> { @@ -473,7 +473,6 @@ */ private final static transient byte VERSION = VERSION0; - @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { @@ -491,7 +490,6 @@ } - @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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/MetadataIndexView.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -28,27 +28,27 @@ package com.bigdata.btree; -import com.bigdata.btree.MetadataIndex.MetadataIndexMetadata; -import com.bigdata.btree.filter.IFilterConstructor; +import com.bigdata.mdi.PartitionLocator; import org.apache.log4j.Logger; import com.bigdata.cache.LRUCache; -import com.bigdata.mdi.PartitionLocator; +import com.bigdata.btree.MetadataIndex.MetadataIndexMetadata; /** * 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 implements IMetadataIndex { +public class MetadataIndexView extends DelegateIndex 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 MetadataIndex metadataIndex; + private final AbstractBTree delegate; /** * <code>true</code> iff this is a read-only view. this is used to @@ -58,14 +58,19 @@ */ final private boolean readOnly; - public MetadataIndexView(MetadataIndex metadataIndex) { - this.metadataIndex = metadataIndex; - this.readOnly = metadataIndex.isReadOnly(); + public MetadataIndexView(AbstractBTree delegate) { + + super(delegate); + + this.delegate = delegate; + + this.readOnly = delegate.isReadOnly(); + } public MetadataIndexMetadata getIndexMetadata() { - return (MetadataIndexMetadata) metadataIndex.getIndexMetadata(); + return (MetadataIndexMetadata) super.getIndexMetadata(); } @@ -82,7 +87,7 @@ * de-serialization using the ITupleSerializer. */ - return (PartitionLocator) metadataIndex.lookup((Object) key); + return (PartitionLocator) delegate.lookup((Object) key); } @@ -107,7 +112,7 @@ */ private PartitionLocator find_with_iterator(byte[] key) { - final ITupleIterator<PartitionLocator> itr = metadataIndex.rangeIterator( + final ITupleIterator<PartitionLocator> itr = delegate.rangeIterator( null/* fromKey */, key/* toKey */, 1/* capacity */, IRangeQuery.VALS | IRangeQuery.REVERSE, null/* filter */); @@ -142,7 +147,7 @@ if (key == null) { // use the index of the last partition. - index = metadataIndex.getEntryCount() - 1; + index = delegate.getEntryCount() - 1; } else { @@ -207,7 +212,7 @@ /** * Remove the locator from the {@link #locatorCache}. It will be re-read on - * demand from the {@link #metadataIndex}. + * demand from the {@link #delegate}. */ public void staleLocator(PartitionLocator locator) { @@ -225,8 +230,8 @@ */ private PartitionLocator getLocatorAtIndex(int index) { - final ITuple<PartitionLocator> tuple = metadataIndex.valueAt(index, - metadataIndex.getLookupTuple()); + final ITuple<PartitionLocator> tuple = delegate.valueAt(index, + delegate.getLookupTuple()); return tuple.getObject(); @@ -247,7 +252,7 @@ */ private int findIndexOf(byte[] key) { - int pos = metadataIndex.indexOf(key); + int pos = delegate.indexOf(key); if (pos < 0) { @@ -261,7 +266,7 @@ if(pos == 0) { - if(metadataIndex.getEntryCount() != 0) { + if(delegate.getEntryCount() != 0) { throw new IllegalStateException( "Partition not defined for empty key."); @@ -289,34 +294,4 @@ } - 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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/Node.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -56,7 +56,6 @@ import cutthecrap.utils.striterators.Expander; import cutthecrap.utils.striterators.SingleValueIterator; import cutthecrap.utils.striterators.Striterator; -import org.apache.log4j.Logger; /** * <p> @@ -83,15 +82,11 @@ * 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 @@ -628,7 +623,7 @@ btree.getBtreeCounters().rootsSplit++; - if (log.isInfoEnabled() || BigdataStatics.debug) { + if (BTree.log.isInfoEnabled() || BigdataStatics.debug) { // Note: nnodes and nleaves might not reflect rightSibling yet. @@ -637,8 +632,8 @@ + ", m=" + btree.getBranchingFactor() + ", nentries=" + btree.nentries; - if (log.isInfoEnabled()) - log.info(msg); + if (BTree.log.isInfoEnabled()) + BTree.log.info(msg); if (BigdataStatics.debug) System.err.println(msg); @@ -2405,8 +2400,8 @@ // one less node in the tree. btree.nnodes--; - if (INFO) { - log.info("reduced tree height: height=" + if (BTree.INFO) { + BTree.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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/btree/ReadOnlyIndex.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -27,9 +27,6 @@ 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; @@ -50,19 +47,20 @@ * @see {@link IResourceManager#getIndex(String, long)} * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ */ -public class ReadOnlyIndex implements IIndex { - - private IIndex src; +public class ReadOnlyIndex extends DelegateIndex { public ReadOnlyIndex(IIndex src) { - this.src = src; + + super(src); + } /** {@link IndexMetadata} is cloned to disallow modification. */ final public IndexMetadata getIndexMetadata() { - return src.getIndexMetadata().clone(); + return super.getIndexMetadata().clone(); } @@ -73,7 +71,7 @@ */ final public IResourceMetadata[] getResourceMetadata() { - return src.getResourceMetadata().clone(); + return super.getResourceMetadata().clone(); } @@ -82,7 +80,7 @@ */ final public ICounter getCounter() { - return new ReadOnlyCounter(src.getCounter()); + return new ReadOnlyCounter(super.getCounter()); } @@ -123,7 +121,7 @@ /* * Must explicitly disable Iterator#remove(). */ - return new ReadOnlyEntryIterator(src.rangeIterator(fromKey, toKey, + return new ReadOnlyEntryIterator(super.rangeIterator(fromKey, toKey, capacity, flags, filter)); } @@ -175,65 +173,4 @@ } - 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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/HardReferenceGlobalLRURecycler.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -618,7 +618,6 @@ e.prior = last; last = e; } - //System.err.println("++size"); size++; counters.bytesInMemory.addAndGet(e.bytesInMemory); counters.bytesOnDisk.addAndGet(e.bytesOnDisk); @@ -660,7 +659,6 @@ 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-14 16:19:22 UTC (rev 3800) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/cache/LRUNexus.java 2010-10-14 20:44:47 UTC (rev 3801) @@ -47,6 +47,7 @@ * system properties defined by {@link Options}. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ * * FIXME LRUNexus : writes MUST must be "isolated" until the commit. * Isolated indices MUST have their own cache backed by the shared LRU @@ -130,6 +131,7 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> + * @version $Id$ */ public static interface Options { @@ -341,13 +343,26 @@ } + /** + * Global instance. + * <p> + * Note: A <a href="http://bugs.sun.com/view_bug.do?bug_id=6880903">Sun G1 + * bug in JDK 1.6.0_16</a> provides a false estimate of the available + * memory. + * + * @see Options + */ + public static final IGlobalLRU<Long, Object> INSTANCE; + + /** * The access policy. Not all {@link IGlobalLRU} implementations support * multiple access policies. Check the specific implementation to see which * policies it supports. * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> + * @version $Id$ */ public static enum AccessPolicyEnum { @@ -380,6 +395,7 @@ * * @author <a href="mailto:tho...@us...">Bryan * Thompson</a> + * @version $Id$ */ public static class CacheSettings { @@ -531,8 +547,9 @@ Options.INDEX_SEGMENT_BUILD_POPULATES_CACHE, Options.DEFAULT_INDEX_SEGMENT_BUILD_POPULATES_CACHE)); ... [truncated message content] |