Class SnapshotRestoreProcess
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreProcess
-
public class SnapshotRestoreProcess extends Object
Distributed process to restore cache group from the snapshot.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSNAPSHOT_RESTORE_METRICSSnapshot restore metrics prefix.static StringTMP_CACHE_DIR_PREFIXTemporary cache directory prefix.
-
Constructor Summary
Constructors Constructor Description SnapshotRestoreProcess(GridKernalContext ctx, ThreadLocal<ByteBuffer> locBuff)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<UUID>cacheStartRequiredAliveNodes(IgniteUuid reqId)IgniteFuture<Boolean>cancel(UUID reqId, String snpName)Cancel the currently running local restore procedure.protected voidcleanup()Cleanup temporary directories if any exists.voidinterrupt(IgniteCheckedException reason)Interrupt the currently running local restore procedure.booleanisRestoring(CacheConfiguration<?,?> ccfg)voidonNodeLeft(UUID leftNodeId)Node left callback.protected voidregisterMetrics()Register local metrics.@Nullable StringrestoringSnapshotName()Get the name of the snapshot currently being restoredIgniteFutureImpl<Void>start(String snpName, @Nullable String snpPath, @Nullable Collection<String> cacheGrpNames, int incIdx, boolean check)Start cache group restore operation.
-
-
-
Field Detail
-
TMP_CACHE_DIR_PREFIX
public static final String TMP_CACHE_DIR_PREFIX
Temporary cache directory prefix.- See Also:
- Constant Field Values
-
SNAPSHOT_RESTORE_METRICS
public static final String SNAPSHOT_RESTORE_METRICS
Snapshot restore metrics prefix.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SnapshotRestoreProcess
public SnapshotRestoreProcess(GridKernalContext ctx, ThreadLocal<ByteBuffer> locBuff)
- Parameters:
ctx- Kernal context.locBuff- Thread local page buffer.
-
-
Method Detail
-
cleanup
protected void cleanup() throws IgniteCheckedExceptionCleanup temporary directories if any exists.- Throws:
IgniteCheckedException- If it was not possible to delete some temporary directory.
-
registerMetrics
protected void registerMetrics()
Register local metrics.
-
start
public IgniteFutureImpl<Void> start(String snpName, @Nullable @Nullable String snpPath, @Nullable @Nullable Collection<String> cacheGrpNames, int incIdx, boolean check)
Start cache group restore operation.- Parameters:
snpName- Snapshot name.snpPath- Snapshot directory path.cacheGrpNames- Cache groups to be restored ornullto restore all cache groups from the snapshot.incIdx- Index of incremental snapshot.check- Iftruecheck snapshot before restore.- Returns:
- Future that will be completed when the restore operation is complete and the cache groups are started.
-
restoringSnapshotName
@Nullable public @Nullable String restoringSnapshotName()
Get the name of the snapshot currently being restored- Returns:
- Name of the snapshot currently being restored or
nullif the restore process is not running.
-
isRestoring
public boolean isRestoring(CacheConfiguration<?,?> ccfg)
- Parameters:
ccfg- Cache configuration.- Returns:
Trueif the cache or group with the specified name is currently being restored.
-
cacheStartRequiredAliveNodes
public Set<UUID> cacheStartRequiredAliveNodes(IgniteUuid reqId)
- Parameters:
reqId- Request ID.- Returns:
- Server nodes on which a successful start of the cache(s) is required, if any of these nodes fails when starting the cache(s), the whole procedure is rolled back.
-
onNodeLeft
public void onNodeLeft(UUID leftNodeId)
Node left callback.- Parameters:
leftNodeId- Left node ID.
-
cancel
public IgniteFuture<Boolean> cancel(UUID reqId, @Deprecated String snpName)
Cancel the currently running local restore procedure.- Parameters:
reqId- Snapshot operation request ID.snpName- Snapshot name.- Returns:
- Future that will be finished when process the process is complete. The result of this future will be
falseif the restore process with the specified snapshot name is not running at all.
-
interrupt
public void interrupt(IgniteCheckedException reason)
Interrupt the currently running local restore procedure.- Parameters:
reason- Interruption reason.
-
-