public class SplitIndexPartitionTask extends AbstractPrepareTask<AbstractResult>
IncrementalBuildTask
or CompactingMergeTask
. The
index partition is passed into this task because it is not yet part of the
view. Based on the nominal size of the index partition and the size of the
segment, N=segSize/nominalSize splits will be generated, requiring N-1
separator keys.
The task uses the linear list API to identify N-1 separator key which would split the index segment and assumes that the data is evenly distributed across the keys within the index segment. The buffered writes are ignored when determining the separator keys (most data will be on the index segment if the journal extent roughly the same as the nominal index segment extent and multiple index partitions are registered on the journal). Application constraints on the choice of the separator keys will be honored and can result in fewer splits being generated.
Once the N-1 split points have been selected, N index segments are built -
one from each of the N key ranges which those N-1 split points define. Once
the index segment for each split has been built, an
SplitIndexPartitionTask.AtomicUpdateSplitIndexPartitionTask
will atomically re-define the
source index partition as N new index partition and copy the buffered writes
into the appropriate index partition. During the atomic update the original
index partition becomes un-defined and new index partitions are defined in
its place which span the same total key range and have the same data.
AtomicUpdateSplitIndexPartitionTask, which MUST be invoked in order to
update the index partition definitions on the live journal and the
{@link MetadataIndex} as an atomic operation.
Modifier and Type | Class and Description |
---|---|
protected static class |
SplitIndexPartitionTask.AtomicUpdateSplitIndexPartitionTask
An
ITx.UNISOLATED operation that splits the live index using the
same Split points, generating new index partitions with new
partition identifiers. |
AbstractTask.DelegateTask<T>, AbstractTask.InnerReadWriteTxServiceCallable<T>, AbstractTask.InnerWriteServiceCallable<T>, AbstractTask.ResubmitException
Modifier and Type | Field and Description |
---|---|
protected UUID[] |
moveTargets |
protected com.bigdata.resources.ViewMetadata |
vmd |
DEBUG, INFO, log, resourceManager
checkpointNanoTime, concurrencyManager, isReadWriteTx, nanoTime_assignedWorker, nanoTime_beginWork, nanoTime_finishedWork, nanoTime_submitTask, readOnly, taskCounters, timestamp, transactionManager, tx
Modifier | Constructor and Description |
---|---|
protected |
SplitIndexPartitionTask(com.bigdata.resources.ViewMetadata vmd,
UUID moveTarget) |
protected |
SplitIndexPartitionTask(com.bigdata.resources.ViewMetadata vmd,
UUID[] moveTargets) |
Modifier and Type | Method and Description |
---|---|
protected void |
clearRefs()
Method is responsible for clearing the
SoftReference s held by
ViewMetadata for the source view(s) on the old journal. |
protected static void |
doSplitAtomicUpdate(ResourceManager resourceManager,
com.bigdata.resources.ViewMetadata vmd,
SplitResult result,
OverflowActionEnum action,
AtomicLong counter,
Event parentEvent) |
protected AbstractResult |
doTask()
Decides how many index partitions should be generated (N) and builds N
IndexSegment s from the source index partition. |
toString
assertResource, assertRunning, assertUnisolated, call, clearLoggingContext, dropIndex, getCommitTime, getIndex, getJournal, getOnlyResource, getResource, getResourceManager, getTaskCounters, getTaskName, getTimestamp, isResource, registerIndex, setupLoggingContext, toString
protected final com.bigdata.resources.ViewMetadata vmd
protected final UUID[] moveTargets
protected SplitIndexPartitionTask(com.bigdata.resources.ViewMetadata vmd, UUID moveTarget)
vmd
- moveTarget
- When non-null
the new right-sibling (the tail)
will be moved to the specified data service after the split.protected SplitIndexPartitionTask(com.bigdata.resources.ViewMetadata vmd, UUID[] moveTargets)
vmd
- moveTargets
- When non-null
the index partitions generated
by the split will be moved to the identified data services. If
this data service is included in the array, then an index
partition will be left on this data service. If the array
contains a single element, then only the rightSibling of the
split will be moved.protected void clearRefs()
AbstractPrepareTask
SoftReference
s 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).
clearRefs
in class AbstractPrepareTask<AbstractResult>
protected AbstractResult doTask() throws Exception
IndexSegment
s from the source index partition. If N will be ONE
(1) if a detailed inspection of the source index partition reveals that
it SHOULD NOT be split.doTask
in class AbstractTask<AbstractResult>
SplitResult
if the index partition was split into 2 or
more index partitions -or- a BuildResult
iff the index
partition was not split.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.protected static void doSplitAtomicUpdate(ResourceManager resourceManager, com.bigdata.resources.ViewMetadata vmd, SplitResult result, OverflowActionEnum action, AtomicLong counter, Event parentEvent)
resourceManager
- vmd
- splits
- result
- action
- counter
- parentEvent
- Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.