protected static class MoveTask.AtomicUpdate extends AbstractAtomicUpdateTask<MoveResult>
This is an "atomic update" operation. It moves an index segment (supplied
by the caller) containing the historical view of the source index
partition and generates and moves an index segment containing any
buffered writes on the live journal for the source index partition to the
target data service. Once the target index partition is registered on the
target data service and the
IMetadataService has been updated to
reflect the move, this task updates the stale locator cache. At that
point clients addressing tasks to the source index partition will
discover that it has been moved.
Note: If the operation fails, then it has no side-effects but the caller is responsible for deleting the historicalWritesBuildResult iff that is deemed necessary (that is, if it is not in use then either put it to use or delete it -- an attractive alternative is to incorporate it into the source index partition view instead.)
Tasks executing after this one will discover that the source index
partition no longer exists as of the timestamp when this task commits.
Clients that submit tasks for the source index partition will be notified
that it no longer exists. When the client queries the
MetadataService it will discover that the key range has been
assigned to a new index partition - the one on the target data service.
Note: This task runs as an
ITx.UNISOLATED operation since it MUST
have an exclusive lock in order to ensure that the buffered writes are
transferred to the target index partition without allowing concurrent
writes on the source index partition.
Note: I have placed the "receive" of the historical index partition view within the atomic update task deliberately. It should add at most a few seconds to the execution time of that task and makes it easier to write corrective actions for the atomic update since we can offer a guarantees such that the existence of the target index partition on the target data service is sufficient to determine that the entire operation was successful.
|Modifier||Constructor and Description|
|Modifier and Type||Method and Description|
Atomic update (move).
assertResource, assertRunning, assertUnisolated, call, clearLoggingContext, dropIndex, getCommitTime, getIndex, getJournal, getOnlyResource, getResource, getResourceManager, getTaskCounters, getTaskName, getTimestamp, isResource, registerIndex, setupLoggingContext, toString
protected MoveTask.AtomicUpdate(ResourceManager resourceManager, String sourceIndexName, BuildResult historicalWritesBuildResult, UUID targetDataServiceUUID, int targetIndexPartitionId, Event parentEvent)
resourceManager- The resource manager.
sourceIndexName- The name of the source index partition.
historicalWritesBuildResult- An index segment containing all data for the source view as of the last commit time on the old journal. This index segment should be generated by a compacting merge or by an index partition split with the same semantics so that we will move the minimum amount of data.
UUIDof the target data service.
targetIndexPartitionId- The partition identifier assigned to the target index partition.
public MoveResult doTask() throws Exception
MoveResultdescribing the operation (this is returned mainly for historical reasons).
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–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.