Class DurableBackgroundCleanupIndexTreeTaskV2
- java.lang.Object
-
- org.apache.ignite.internal.dto.IgniteDataTransferObject
-
- org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2
-
- All Implemented Interfaces:
Externalizable,Serializable,DurableBackgroundTask<Long>
public class DurableBackgroundCleanupIndexTreeTaskV2 extends IgniteDataTransferObject implements DurableBackgroundTask<Long>
Task for background cleaning of index trees.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDurableBackgroundCleanupIndexTreeTaskV2.InlineIndexTreeFactoryFactory for creating index trees.static classDurableBackgroundCleanupIndexTreeTaskV2.NoopRowHandlerFactoryA do-nothingInlineIndexRowHandlerFactoryimplementation.
-
Field Summary
Fields Modifier and Type Field Description static DurableBackgroundCleanupIndexTreeTaskV2.InlineIndexTreeFactoryidxTreeFactoryIndex tree index factory.
-
Constructor Summary
Constructors Constructor Description DurableBackgroundCleanupIndexTreeTaskV2()Default constructor forExternalizable.DurableBackgroundCleanupIndexTreeTaskV2(@Nullable String grpName, String cacheName, String idxName, String oldTreeName, String newTreeName, int segments, @Nullable InlineIndexTree[] trees)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcacheName()voidcancel()Canceling the task.static longdestroyIndexTrees(CacheGroupContext grpCtx, RootPage rootPage, String cacheName, String treeName, int segment)Destroying index trees.IgniteInternalFuture<DurableBackgroundTaskResult<Long>>executeAsync(GridKernalContext ctx)Asynchronous task execution.static Map<Integer,RootPage>findIndexRootPages(CacheGroupContext grpCtx, String cacheName, String treeName, int segments)Finding the root pages of the index.StringidxName()Stringname()Getting the name of the task to identify it.booleanneedToRename()protected voidreadExternalData(byte protoVer, ObjectInput in)Load object's specific data content.static voidrenameIndexRootPages(CacheGroupContext grpCtx, String cacheName, String oldTreeName, String newTreeName, int segments)Renaming the root index pages.voidrenameIndexTrees(CacheGroupContext grpCtx)Renames index's trees.static Map<Integer,RootPage>toRootPages(InlineIndexTree[] trees)Create index root pages based on its trees.StringtoString()protected voidwriteExternalData(ObjectOutput out)Save object's specific data content.-
Methods inherited from class org.apache.ignite.internal.dto.IgniteDataTransferObject
getProtocolVersion, readExternal, toList, toSet, writeExternal
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.persistence.metastorage.pendingtask.DurableBackgroundTask
convertAfterRestoreIfNeeded
-
-
-
-
Field Detail
-
idxTreeFactory
public static DurableBackgroundCleanupIndexTreeTaskV2.InlineIndexTreeFactory idxTreeFactory
Index tree index factory. NOTE: Change only in tests, to control the creation of trees in the task.
-
-
Constructor Detail
-
DurableBackgroundCleanupIndexTreeTaskV2
public DurableBackgroundCleanupIndexTreeTaskV2(@Nullable @Nullable String grpName, String cacheName, String idxName, String oldTreeName, String newTreeName, int segments, @Nullable @Nullable InlineIndexTree[] trees)Constructor.- Parameters:
grpName- Cache group name.cacheName- Cache name.idxName- Index name.oldTreeName- Old name of underlying index tree name.newTreeName- New name of underlying index tree name.segments- Number of segments.trees- Index trees.
-
DurableBackgroundCleanupIndexTreeTaskV2
public DurableBackgroundCleanupIndexTreeTaskV2()
Default constructor forExternalizable.
-
-
Method Detail
-
writeExternalData
protected void writeExternalData(ObjectOutput out) throws IOException
Save object's specific data content.- Specified by:
writeExternalDatain classIgniteDataTransferObject- Parameters:
out- Output object to write data content.- Throws:
IOException- If I/O errors occur.
-
readExternalData
protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundExceptionLoad object's specific data content.- Specified by:
readExternalDatain classIgniteDataTransferObject- Parameters:
protoVer- Input object version.in- Input object to load data content.- Throws:
IOException- If I/O errors occur.ClassNotFoundException- If the class for an object being restored cannot be found.
-
name
public String name()
Getting the name of the task to identify it. Also used as part of a key for storage in a MetaStorage.- Specified by:
namein interfaceDurableBackgroundTask<Long>- Returns:
- Task name.
-
cancel
public void cancel()
Canceling the task.- Specified by:
cancelin interfaceDurableBackgroundTask<Long>
-
executeAsync
public IgniteInternalFuture<DurableBackgroundTaskResult<Long>> executeAsync(GridKernalContext ctx)
Asynchronous task execution. Completion of the task execution should be only with theresult.- Specified by:
executeAsyncin interfaceDurableBackgroundTask<Long>- Parameters:
ctx- Kernal context.- Returns:
- Future of the tasks.
-
renameIndexTrees
public void renameIndexTrees(CacheGroupContext grpCtx) throws IgniteCheckedException
Renames index's trees.- Parameters:
grpCtx- Cache group context.- Throws:
IgniteCheckedException- If failed to rename index's trees.
-
destroyIndexTrees
public static long destroyIndexTrees(CacheGroupContext grpCtx, RootPage rootPage, String cacheName, String treeName, int segment) throws IgniteCheckedException
Destroying index trees.- Parameters:
grpCtx- Cache group context.rootPage- Index root page.cacheName- Cache name.treeName- Name of underlying index tree name.segment- Segment number.- Returns:
- Total number of pages recycled from this tree.
- Throws:
IgniteCheckedException- If failed.
-
findIndexRootPages
public static Map<Integer,RootPage> findIndexRootPages(CacheGroupContext grpCtx, String cacheName, String treeName, int segments) throws IgniteCheckedException
Finding the root pages of the index.- Parameters:
grpCtx- Cache group context.cacheName- Cache name.treeName- Name of underlying index tree name.segments- Number of segments.- Returns:
- Index root pages. Mapping: segment number -> index root page.
- Throws:
IgniteCheckedException- If failed.
-
renameIndexRootPages
public static void renameIndexRootPages(CacheGroupContext grpCtx, String cacheName, String oldTreeName, String newTreeName, int segments) throws IgniteCheckedException
Renaming the root index pages.- Parameters:
grpCtx- Cache group context.cacheName- Cache name.oldTreeName- Old name of underlying index tree name.newTreeName- New name of underlying index tree name.segments- Number of segments.- Throws:
IgniteCheckedException- If failed.
-
toRootPages
public static Map<Integer,RootPage> toRootPages(InlineIndexTree[] trees)
Create index root pages based on its trees.- Parameters:
trees- Index trees.- Returns:
- Index root pages. Mapping: segment number -> index root page.
-
cacheName
public String cacheName()
- Returns:
- Cache name.
-
idxName
public String idxName()
- Returns:
- Index name.
-
needToRename
public boolean needToRename()
- Returns:
trueif needs to rename index trees,falseotherwise.
-
-