com.bigdata.service.ndx
Class PartitionedTupleIterator<E>

java.lang.Object
  extended by com.bigdata.service.ndx.PartitionedTupleIterator<E>
All Implemented Interfaces:
ITupleIterator<E>, Iterator<ITuple<E>>

public class PartitionedTupleIterator<E>
extends Object
implements ITupleIterator<E>

Class supports range query across one or more index partitions. Each partition is mapped onto a single DataServiceTupleIterator query. In turn, the DataServiceTupleIterator may make several queries to the data service per partition. The actual #of queries made to the data service depends on the #of index entries that are visited per partition and the capacity specified to the ctor. StaleLocatorExceptions are handled transparently by restarting the locator scan and continuing the range query request from the successor (or predecessor for a reverse scan) of the last key visited. When the operation is unisolated, this class will correctly complete the range iterator request even if the index partition is split, joined or moved during traversal.

Version:
$Id: PartitionedTupleIterator.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected static boolean INFO
           
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
PartitionedTupleIterator(IScaleOutClientIndex ndx, long ts, boolean isReadConsistentTx, byte[] fromKey, byte[] toKey, int capacity, int flags, IFilterConstructor filter)
           Note: The PartitionedTupleIterator uses a sequential scan (rather than mapping across the index partitions in parallel) and always picks up from the successor of the last key visited.
 
Method Summary
protected  void finalize()
           
 int getPartitionCount()
          Deprecated. The #of partitions is a bit tricky since splits and joins can introduce new partitions unless you are using a read-consistent view.
 long getVisitedCount()
          The #of entries visited so far (not the #of entries scanned, which can be much greater if a filter is in use).
 boolean hasNext()
           
 ITuple<E> next()
          Advance the iterator and return the ITuple from which you can extract the data and metadata for next entry.
 void remove()
          Batch delete behind semantics.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final transient org.apache.log4j.Logger log

INFO

protected static final boolean INFO
Constructor Detail

PartitionedTupleIterator

public PartitionedTupleIterator(IScaleOutClientIndex ndx,
                                long ts,
                                boolean isReadConsistentTx,
                                byte[] fromKey,
                                byte[] toKey,
                                int capacity,
                                int flags,
                                IFilterConstructor filter)

Note: The PartitionedTupleIterator uses a sequential scan (rather than mapping across the index partitions in parallel) and always picks up from the successor of the last key visited. Read-consistent is achieved by specifying a commitTime for the timestamp rather than ITx.READ_COMMITTED. The latter will use dirty reads (each time a ResultSet is fetched it will be fetched from the most recently committed state of the database).

Parameters:
ndx -
ts - The timestamp for the view (may be a transaction).
isReadConsistentTx - true iff the caller specified timestamp is a read-historical transaction created specifically to give the iterator read-consistent semantics. when true, this class will ensure that the transaction is eventually aborted so that its read lock will be released. This is done eagerly when the iterator is exhausted and with a finalize() method otherwise.
fromKey -
toKey -
capacity -
flags -
filter -
Throws:
IllegalArgumentException - if readConsistent is requested and the index view is ITx.UNISOLATED.
Method Detail

getPartitionCount

public int getPartitionCount()
Deprecated. The #of partitions is a bit tricky since splits and joins can introduce new partitions unless you are using a read-consistent view.

The #of index partitions queried so far.


getVisitedCount

public long getVisitedCount()
The #of entries visited so far (not the #of entries scanned, which can be much greater if a filter is in use).


finalize

protected void finalize()
Overrides:
finalize in class Object

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<ITuple<E>>

next

public ITuple<E> next()
Description copied from interface: ITupleIterator
Advance the iterator and return the ITuple from which you can extract the data and metadata for next entry.

Note: An ITupleIterators will generally return the same ITuple reference on on each invocation of this method. The caller is responsible for copying out any data or metadata of interest before calling ITupleIterator.next() again. See TupleFilter which is aware of this and can be used to stack filters safely.

Specified by:
next in interface ITupleIterator<E>
Specified by:
next in interface Iterator<ITuple<E>>
Returns:
The ITuple containing the data and metadata for the current index entry.

remove

public void remove()
Batch delete behind semantics.

Specified by:
remove in interface Iterator<ITuple<E>>
See Also:
AbstractChunkedTupleIterator.remove()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.