com.bigdata.resources
Class OverflowMetadata

java.lang.Object
  extended by com.bigdata.resources.OverflowMetadata

public class OverflowMetadata
extends Object

Metadata on the entire synchronous and asynchronous overflow task.

Version:
$Id: OverflowMetadata.java 2783 2010-05-07 13:14:20Z thompsonbry $
Author:
Bryan Thompson

Field Summary
 long lastCommitTime
          The last commit time on the old journal.
protected static org.apache.log4j.Logger log
           
 boolean postProcess
          Set true iff asynchronous post-processing should be performed.
 ResourceManager resourceManager
          The resource manager.
 
Constructor Summary
OverflowMetadata(ResourceManager resourceManager)
          Captures various metadata about the live journal in preparation for a synchronous overflow operation.
 
Method Summary
 int getActionCount(OverflowActionEnum action)
          Return the #of index partitions for which the specified action was chosen.
 int getActiveCount()
          The #of active index partitions on this data service.
 int getIndexCount()
          The #of indices on the old journal.
 com.bigdata.resources.Score getScore(String name)
          Return true if the named index partition is "warm" for ITx.UNISOLATED and/or ITx.READ_COMMITTED operations.
 List<com.bigdata.resources.Score> getScores()
          The scores in order from least active to most active.
 com.bigdata.resources.ViewMetadata getViewMetadata(String name)
          Random lookup of the ViewMetadata.
 boolean isCopied(String name)
          True if the tuples for the index were copied to the new live journal during synchronous overflow.
 void setAction(String name, OverflowActionEnum action)
          Specify the action to be taken.
 Iterator<com.bigdata.resources.ViewMetadata> views()
          The views that are being processed in index name order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log

resourceManager

public final ResourceManager resourceManager
The resource manager.


lastCommitTime

public final long lastCommitTime
The last commit time on the old journal. This identifies the commit point on which synchronous and asynchronous overflow will read.


postProcess

public boolean postProcess
Set true iff asynchronous post-processing should be performed. Flag is set iff some indices are NOT copied onto the new journal such that asynchronous post-processing should be performed.

Constructor Detail

OverflowMetadata

public OverflowMetadata(ResourceManager resourceManager)
Captures various metadata about the live journal in preparation for a synchronous overflow operation.

Note: This captures metadata which has low latency and does not force the materialization of the fused view of an index partition but may force the loading of the BTree from the old journal, which it itself a very light weight operation.

Parameters:
resourceManager -
Method Detail

getViewMetadata

public final com.bigdata.resources.ViewMetadata getViewMetadata(String name)
Random lookup of the ViewMetadata.

Parameters:
name - The index name.
Returns:
The ViewMetadata and null if none is found.
Throws:
IllegalStateException - if #collectMoreData(ResourceManager) has not been called.

views

public Iterator<com.bigdata.resources.ViewMetadata> views()
The views that are being processed in index name order.


getIndexCount

public int getIndexCount()
The #of indices on the old journal.


isCopied

public boolean isCopied(String name)
True if the tuples for the index were copied to the new live journal during synchronous overflow.

Parameters:
name - The name of the index partition.
Returns:

setAction

public void setAction(String name,
                      OverflowActionEnum action)
Specify the action to be taken.

Parameters:
name - The index partition name.
action - The action.
Throws:
IllegalStateException - if an action has already been specified.

getActionCount

public int getActionCount(OverflowActionEnum action)
Return the #of index partitions for which the specified action was chosen.

Parameters:
action - The action.
Returns:
The #of index partitions where that action was chosen.
TODO:
This is only used by the unit tests as a means of verifying that they have set OverflowManager.copyIndexThreshold to zero. This stands in the way of decoupling asynchronous overflow from a fixed cycle such that index partition build, merge, split, etc. tasks can run at any time (other than while some other task is running).

Note: we must also give OverflowManager.doSynchronousOverflow() exclusive access so it can propagate the index partition declarations without blocking. Right now, asynchronous index tasks do not execute during synchronous overflow so there is no problem. This does have the consequence that the set of locks is per OverflowMetadata instance (and hence only valid for the epoch between one synchronous overflow and the next).


getActiveCount

public int getActiveCount()
The #of active index partitions on this data service.


getScores

public List<com.bigdata.resources.Score> getScores()
The scores in order from least active to most active.


getScore

public com.bigdata.resources.Score getScore(String name)
Return true if the named index partition is "warm" for ITx.UNISOLATED and/or ITx.READ_COMMITTED operations.

Note: This method informs the selection of index partitions that will be moved to another IDataService. The preference is always to move an index partition that is "warm" rather than "hot" or "cold". Moving a "hot" index partition causes more latency since more writes will have been buffered and unisolated access to the index partition will be suspended during the atomic part of the move operation. Likewise, "cold" index partitions are not consuming any resources other than disk space for their history, and the history of an index is not moved when the index partition is moved.

Since the history of an index partition is not moved when the index partition is moved, the determination of cold, warm or hot is made in terms of the resources consumed by ITx.READ_COMMITTED and ITx.UNISOLATED access to named index partitions. If an index partition is hot for historical read, then your only choices are to shed other index partitions from the data service, to read from a failover data service having the same index partition, or possibly to increase the replication count for the index partition.

Parameters:
name - The name of an index partition.
Returns:
The index Score -or- null iff the index was not touched for read-committed or unisolated operations.


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