com.bigdata.resources
Class CompactingMergeTask

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

public class CompactingMergeTask
extends AbstractPrepareTask<BuildResult>

Task builds an IndexSegment from the fused view of an index partition as of some historical timestamp and then atomically updates the view (aka a compacting merge).

Note: This task may be used after IResourceManager.overflow() in order to produce a compact view of the index as of the lastCommitTime on the old journal.

Note: As its last action, this task submits a CompactingMergeTask.AtomicUpdateCompactingMergeTask which replaces the view with one defined by the current BTree on the journal and the newly built IndexSegment.

Note: If the task fails, then the generated IndexSegment will be deleted.

Version:
$Id: CompactingMergeTask.java 3343 2010-07-29 14:55:40Z thompsonbry $
Author:
Bryan Thompson

Nested Class Summary
protected static class CompactingMergeTask.AtomicUpdateCompactingMergeTask
           The source view is pre-overflow (the last writes are on the old journal) while the current view is post-overflow (reflects writes made since overflow).
 
Nested classes/interfaces inherited from class com.bigdata.journal.AbstractTask
AbstractTask.DelegateTask<T>, AbstractTask.InnerReadWriteTxServiceCallable, AbstractTask.InnerWriteServiceCallable<T>, AbstractTask.ResubmitException
 
Field Summary
protected  com.bigdata.resources.ViewMetadata vmd
           
 
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
CompactingMergeTask(com.bigdata.resources.ViewMetadata vmd)
           
 
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  BuildResult doTask()
          Build an IndexSegment from the compacting merge of an index partition.
protected  boolean shouldMove(ILoadBalancerService loadBalancerService)
          Figure out if this data service is considered to be highly utilized, in which case the DS should shed some index partitions.
 
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
 

Field Detail

vmd

protected final com.bigdata.resources.ViewMetadata vmd
Constructor Detail

CompactingMergeTask

public CompactingMergeTask(com.bigdata.resources.ViewMetadata vmd)
Parameters:
vmd - The ViewMetadata for the index partition.
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<BuildResult>

doTask

protected BuildResult doTask()
                      throws Exception
Build an IndexSegment from the compacting merge of an index partition.

Specified by:
doTask in class AbstractTask<BuildResult>
Returns:
The BuildResult.
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.

shouldMove

protected boolean shouldMove(ILoadBalancerService loadBalancerService)
Figure out if this data service is considered to be highly utilized, in which case the DS should shed some index partitions.

Note: We consult the load balancer service on this since it is able to put the load of this service into perspective by also considering the load on the other services in the federation.

Parameters:
loadBalancerService - The load balancer.


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