voldemort.server.protocol.admin
Class FullScanFetchStreamRequestHandler

java.lang.Object
  extended by voldemort.server.protocol.admin.FetchStreamRequestHandler
      extended by voldemort.server.protocol.admin.FullScanFetchStreamRequestHandler
All Implemented Interfaces:
StreamRequestHandler
Direct Known Subclasses:
FullScanFetchEntriesRequestHandler, FullScanFetchKeysRequestHandler

public abstract class FullScanFetchStreamRequestHandler
extends FetchStreamRequestHandler

Base class for key/entry stream fetching handlers that do an unordered full scan to fetch items.


Nested Class Summary
 
Nested classes/interfaces inherited from interface voldemort.server.protocol.StreamRequestHandler
StreamRequestHandler.StreamRequestDirection, StreamRequestHandler.StreamRequestHandlerState
 
Field Summary
protected  ClosableIterator<ByteArray> keyIterator
           
protected  java.util.Map<java.lang.Integer,java.lang.Long> partitionFetches
           
protected  java.util.Set<java.lang.Integer> partitionsToFetch
           
 
Fields inherited from class voldemort.server.protocol.admin.FetchStreamRequestHandler
errorCodeMapper, fetched, fetchOrphaned, filter, initialCluster, isJmxEnabled, logger, nodeId, operation, partitionIds, recordsPerPartition, request, scanned, startTimeMs, storageEngine, storeDef, storeInstance, streamStats, throttler
 
Fields inherited from interface voldemort.server.protocol.StreamRequestHandler
STAT_RECORDS_INTERVAL
 
Constructor Summary
FullScanFetchStreamRequestHandler(VAdminProto.FetchPartitionEntriesRequest request, MetadataStore metadataStore, ErrorCodeMapper errorCodeMapper, VoldemortConfig voldemortConfig, StoreRepository storeRepository, NetworkClassLoader networkClassLoader, StreamingStats.Operation operation)
           
 
Method Summary
protected  void accountForFetchedKey(byte[] key)
          Account for key being fetched.
 void close(java.io.DataOutputStream outputStream)
           
protected  StreamRequestHandler.StreamRequestHandlerState determineRequestHandlerState(java.lang.String itemTag)
          Determines if still WRITING or COMPLETE.
protected  boolean fetchedEnoughForAllPartitions()
          True iff enough items have been fetched for all partitions, where 'enough' is relative to recordsPerPartition value.
protected  boolean isItemAccepted(byte[] key)
          Determines if entry is accepted.
protected  boolean isKeyNeeded(byte[] key)
          Determines if the key is needed.
 
Methods inherited from class voldemort.server.protocol.admin.FetchStreamRequestHandler
accountForScanProgress, getDirection, handleError, progressInfoMessage, reportStorageOpTime, sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface voldemort.server.protocol.StreamRequestHandler
handleRequest
 

Field Detail

keyIterator

protected final ClosableIterator<ByteArray> keyIterator

partitionFetches

protected java.util.Map<java.lang.Integer,java.lang.Long> partitionFetches

partitionsToFetch

protected java.util.Set<java.lang.Integer> partitionsToFetch
Constructor Detail

FullScanFetchStreamRequestHandler

public FullScanFetchStreamRequestHandler(VAdminProto.FetchPartitionEntriesRequest request,
                                         MetadataStore metadataStore,
                                         ErrorCodeMapper errorCodeMapper,
                                         VoldemortConfig voldemortConfig,
                                         StoreRepository storeRepository,
                                         NetworkClassLoader networkClassLoader,
                                         StreamingStats.Operation operation)
Method Detail

isKeyNeeded

protected boolean isKeyNeeded(byte[] key)
Determines if the key is needed. To be 'needed', a key must (i) belong to a partition being requested and (ii) be necessary to meet recordsPerPartition constraint, if any.

Parameters:
key -
Returns:
true iff key is needed.

isItemAccepted

protected boolean isItemAccepted(byte[] key)
Determines if entry is accepted. For normal usage, this means confirming that the key is needed. For orphan usage, this simply means confirming the key belongs to the node.

Parameters:
key -
Returns:
true iff entry is accepted.

accountForFetchedKey

protected void accountForFetchedKey(byte[] key)
Account for key being fetched.

Parameters:
key -

fetchedEnoughForAllPartitions

protected boolean fetchedEnoughForAllPartitions()
True iff enough items have been fetched for all partitions, where 'enough' is relative to recordsPerPartition value.

Returns:
true iff enough items have been fetched for all partitions

determineRequestHandlerState

protected StreamRequestHandler.StreamRequestHandlerState determineRequestHandlerState(java.lang.String itemTag)
Determines if still WRITING or COMPLETE.

Parameters:
itemTag - mad libs style string to insert into progress message.
Returns:
state of stream request handler

close

public final void close(java.io.DataOutputStream outputStream)
                 throws java.io.IOException
Specified by:
close in interface StreamRequestHandler
Overrides:
close in class FetchStreamRequestHandler
Throws:
java.io.IOException


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu