com.bigdata.resources
Class SplitTailTask

java.lang.Object
  extended by com.bigdata.journal.AbstractTask<T>
      extended by com.bigdata.resources.AbstractResourceManagerTask<T>
          extended by com.bigdata.resources.AbstractPrepareTask
              extended by com.bigdata.resources.SplitTailTask
All Implemented Interfaces:
ITask, Callable

public class SplitTailTask
extends AbstractPrepareTask

Splits the tail of an index partition and optionally submits a task to move the tail to a target data service specified by the caller.

The split point is choosen by locating the right-most non-leaf node. The key range which would enter that node is placed within the new right-sibling index partition. The rest of the key range is placed within the new left-sibling index partition.

The tail split operation is extremely fast since it only redefines the index partitions. However, it require RMI to the metadata index to do that and therefore should not be done during synchronous overflow in order to reduce the possibility for errors during that operation.

The right-sibling of tail split is a prime candidate for a move since there is an expectation that it will continue to be hot for writes. Therefore the caller has an opportunity when specifying a tail split to also specify that the new right-sibling index partition will be moved onto a caller specified data service.

Version:
$Id: SplitTailTask.java 2783 2010-05-07 13:14:20Z thompsonbry $
Author:
Bryan Thompson
TODO:
unit tests.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bigdata.journal.AbstractTask
AbstractTask.DelegateTask<T>, AbstractTask.InnerReadWriteTxServiceCallable, AbstractTask.InnerWriteServiceCallable<T>, AbstractTask.ResubmitException
 
Field Summary
 
Fields inherited from class com.bigdata.resources.AbstractResourceManagerTask
DEBUG, INFO, log, resourceManager
 
Fields inherited from class com.bigdata.journal.AbstractTask
checkpointNanoTime, concurrencyManager, isReadWriteTx, nanoTime_assignedWorker, nanoTime_beginWork, nanoTime_finishedWork, nanoTime_submitTask, readOnly, taskCounters, timestamp, transactionManager, tx
 
Constructor Summary
SplitTailTask(com.bigdata.resources.ViewMetadata vmd, UUID moveTarget)
           
 
Method Summary
protected  void clearRefs()
          Method is responsible for clearing the SoftReferences held by ViewMetadata for the source view(s) on the old journal.
protected  Object doTask()
          Implement the task behavior here.
 
Methods inherited from class com.bigdata.resources.AbstractResourceManagerTask
toString
 
Methods inherited from class com.bigdata.journal.AbstractTask
assertResource, assertRunning, assertUnisolated, call, clearLoggingContext, dropIndex, getCommitTime, getIndex, getJournal, getOnlyResource, getResource, getResourceManager, getTaskCounters, getTaskName, getTimestamp, isResource, registerIndex, setupLoggingContext, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SplitTailTask

public SplitTailTask(com.bigdata.resources.ViewMetadata vmd,
                     UUID moveTarget)
Parameters:
vmd -
moveTarget - When non-null the new right-sibling (the tail) will be moved to the specified data service after the split.
Method Detail

clearRefs

protected void clearRefs()
Description copied from class: AbstractPrepareTask
Method is responsible for clearing the SoftReferences held by ViewMetadata for the source view(s) on the old journal.

Note: This method MUST be invoked in order to permit those references to be cleared more eagerly than the end of the entire asynchronous overflow operation (which is when the task references would themselves go out of scope and become available for GC).

Specified by:
clearRefs in class AbstractPrepareTask

doTask

protected Object doTask()
                 throws Exception
Description copied from class: AbstractTask
Implement the task behavior here.

Note: Long-running implementations MUST periodically test Thread.interrupted() and MUST throw an exception, such as InterruptedException, if they are interrupted. This behavior allows tasks to be canceled in a timely manner.

If you ignore or fail to test Thread.interrupted() then your task CAN NOT be aborted. If it is Future.cancel(boolean) with false then the task will run to completion even though it has been cancelled (but the Future will appear to have been cancelled).

If you simply return rather than throwing an exception then the WriteExecutorService will assume that your task completed and your (partial) results will be made restart-safe at the next commit!

Specified by:
doTask in class AbstractTask
Returns:
The object that will be returned by AbstractTask.call() iff the operation succeeds.
Throws:
Exception - The exception that will be thrown by AbstractTask.call() iff the operation fails.
InterruptedException - This exception SHOULD be thrown if Thread.interrupted() becomes true during execution.


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