public class FileDatabaseSnapshotSpi extends Object implements org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
Modifier and Type | Field and Description |
---|---|
static String |
CANCELLED_FILENAME
Cancelled filename.
|
static String |
COPY_MARKER_FILENAME
Copy marker filename.
|
static String |
LOCK_FILENAME
Lock filename.
|
static String |
SNAPSHOT_DIR_SUFFIX
Snapshot directory suffix.
|
static String |
SNAPSHOT_WAL_DIR
Snapshot wal directory.
|
Constructor and Description |
---|
FileDatabaseSnapshotSpi()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
copyDigestRegistry(long snapshotId,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath file,
org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext context) |
void |
copyMetadata(long snapshotId,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToMove,
org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext context) |
void |
copySinglePartition(long snapshotId,
int grpId,
int partId,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToCopy,
org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext context)
Will copy only single partition.
|
void |
copySnapshotEntirely(long snapshotId,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToCopy,
org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext ctx,
ExecutorService taskExecutor)
Will copy snapshot completely to the path.
|
void |
copyWalSegments(long snapshotId,
Collection<File> segments,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath dir,
org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext ctx) |
protected FileSnapshot |
createFileSnapshot(IgniteConfiguration igCfg,
FileDatabaseSnapshotSpi snapshotSpi,
long id,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath snapshotDir,
Collection<org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> optSearchPath,
IgniteBiClosure<String,CacheConfiguration,CacheConfiguration> c,
boolean ignoreMissedClasses,
boolean remote,
SnapshotSecurityLevel securityLevel,
MessageDigestFactory msgDigestFactory,
SnapshotRegistryTransformer registryTransformer,
org.apache.ignite.internal.processors.cache.GridCacheSharedContext cctx)
To facilitate tests we need to wrap constructor of FileSnapshot in this method.
|
void |
deleteSnapshot(long id,
org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext ctx) |
static long |
extractIdFromSnapshotDirName(String dirName)
Get snapshot id from directory name.
|
<T extends org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> |
findCurNodeSnapshotDir(T snapshotBaseFolder,
long id)
Find snapshot for curent node.
|
@Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.FsSnapshotPath |
findLocalCurNodeSnapshotDir(long id) |
@Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.FsSnapshotPath |
findLocalSnapshotDir(long id) |
<T extends org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> |
findSnapshotDir(T snapshotBaseFolder,
long id) |
void |
finishCopy(long snapshotId,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToCopy)
Removes copy marker file to indicate the end of copy operation.
|
@NotNull org.gridgain.grid.internal.processors.cache.database.snapshot.file.FsSnapshotPath |
generateCurNodeSnapshotFolderPath(long id) |
<T extends org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> |
generateCurNodeSnapshotFolderPathWithLabel(T snapshotBaseFolder,
long id,
String label)
Generate path with label for snapshot.
|
static String |
generateSnapshotDirName(long id,
@Nullable String lb)
!!!
|
<T extends org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> |
generateSnapshotFolderPath(T snapshotBaseFolder,
long id) |
boolean |
isCopyRequired(long snapshotId,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath targetDirectory)
Method checks whether copy is required or not.
|
Iterable<org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotMetadataV2> |
listRemoteSnapshots(@Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath searchPath)
Returns all completed snapshots that can be restored.
|
Iterable<org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotMetadataV2> |
localSnapshots(boolean sort)
Returns all completed snapshots that can be restored.
|
@Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotMetadataV2 |
nextLocalSnapshot(long id)
Search for meta of next ascending snapshot, or
null if not found. |
Map<Long,Long> |
remoteSnapshotWalSizes(@Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath searchPath)
Retrieving total segment sizes for remote snapshots.
|
long |
remoteSnapshotWalSizes(@Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath searchPath,
long snapshotId)
Retrieving total segment sizes for a remote snapshot.
|
org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotSession |
sessionForSnapshotCreation(long id,
boolean fullSnapshot,
@Nullable File storePath,
org.gridgain.grid.internal.processors.cache.database.snapshot.CompressionOption compression,
int compressionLevel,
org.gridgain.grid.internal.processors.cache.database.snapshot.FutureTaskQueue<org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId> futureTaskQueue,
org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext snapshotOperationContext,
@Nullable MessageDigestFactory msgDigestFactory,
@Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotEncryptionOptions encryptionOptions)
Starts a snapshot session.
|
void |
setSnapshotDirectory(String snapshotDir) |
void |
setSnapshotMetrics(SnapshotMetricsMXBean snapshotMetrics)
Set SnapshotMetricsMXBean reference.
|
@Nullable FileSnapshot |
snapshot(long id,
@Nullable Collection<org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> optSearchPaths,
@Nullable IgniteBiClosure<String,CacheConfiguration,CacheConfiguration> c,
boolean ignoreMissedClasses,
@Nullable SnapshotSecurityLevel securityLevel,
boolean needDecryptKeys)
Getting snapshot.
|
File |
snapshotWorkingDirectory() |
void |
start()
Starts SPI.
|
void |
startCopy(long snapshotId,
org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToCopy)
Marks directory with copy marker file, to indicate the beginning of copy operation.
|
void |
stop()
Stops SPI.
|
public static final String SNAPSHOT_DIR_SUFFIX
public static final String SNAPSHOT_WAL_DIR
public static final String LOCK_FILENAME
public static final String CANCELLED_FILENAME
public static final String COPY_MARKER_FILENAME
public File snapshotWorkingDirectory()
snapshotWorkingDirectory
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
public void setSnapshotDirectory(String snapshotDir)
snapshotDir
- Snapshot directory.public void setSnapshotMetrics(SnapshotMetricsMXBean snapshotMetrics)
setSnapshotMetrics
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotMetrics
- Instance of metrics.public void start() throws IgniteCheckedException
start
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
IgniteCheckedException
- If failed to start.public void stop() throws IgniteCheckedException
stop
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
IgniteCheckedException
- If failed to stop.public org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotSession sessionForSnapshotCreation(long id, boolean fullSnapshot, @Nullable @Nullable File storePath, org.gridgain.grid.internal.processors.cache.database.snapshot.CompressionOption compression, int compressionLevel, org.gridgain.grid.internal.processors.cache.database.snapshot.FutureTaskQueue<org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId> futureTaskQueue, org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext snapshotOperationContext, @Nullable @Nullable MessageDigestFactory msgDigestFactory, @Nullable @Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotEncryptionOptions encryptionOptions) throws IgniteCheckedException
sessionForSnapshotCreation
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
id
- Snapshot ID.fullSnapshot
- Incremental flag.storePath
- Path to directory where snapshot will be stored.
If storePath
null
then storePath
will default snapshot work dir.compression
- If ZIP
then compressionOption of snapshot files is enabled.compressionLevel
- Level of compression in case of compression is enabled.futureTaskQueue
- Partitions future task post processor.snapshotOperationContext
- Level of compression in case of compression is enabled.msgDigestFactory
- Message digest factory, or null
if security level is disabled.encryptionOptions
- Snapshot encryption options.IgniteCheckedException
public Iterable<org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotMetadataV2> localSnapshots(boolean sort) throws IgniteCheckedException
next
directly reads appropriate snapshots meta.localSnapshots
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
sort
- Sort by id.IgniteCheckedException
public Iterable<org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotMetadataV2> listRemoteSnapshots(@Nullable @Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath searchPath) throws IgniteCheckedException
next
directly reads appropriate snapshots meta.listRemoteSnapshots
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
searchPath
- Snapshot work directory.IgniteCheckedException
public Map<Long,Long> remoteSnapshotWalSizes(@Nullable @Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath searchPath)
remoteSnapshotWalSizes
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
searchPath
- Snapshot work directory.public long remoteSnapshotWalSizes(@Nullable @Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath searchPath, long snapshotId)
remoteSnapshotWalSizes
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
searchPath
- Snapshot work directory.snapshotId
- ID of a specific snapshot.@Nullable public @Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotMetadataV2 nextLocalSnapshot(long id)
null
if not found.
It is not recommended to use for iteration, you should use DatabaseSnapshotSpi.localSnapshots(boolean)
for this.nextLocalSnapshot
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
id
- Id of current snapshot.protected FileSnapshot createFileSnapshot(IgniteConfiguration igCfg, FileDatabaseSnapshotSpi snapshotSpi, long id, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath snapshotDir, Collection<org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> optSearchPath, IgniteBiClosure<String,CacheConfiguration,CacheConfiguration> c, boolean ignoreMissedClasses, boolean remote, SnapshotSecurityLevel securityLevel, MessageDigestFactory msgDigestFactory, SnapshotRegistryTransformer registryTransformer, org.apache.ignite.internal.processors.cache.GridCacheSharedContext cctx)
snapshotSpi
- Snapshot SPI.id
- Snapshot ID.snapshotDir
- The directory where this snapshot was found.optSearchPath
- Collection of directories to search for snapshots.c
- CacheConfig conversion closure.ignoreMissedClasses
- If true
ignore ClassNotFoundException when read snapshot.remote
- false if localsecurityLevel
- Snapshot security level.cctx
- Cache shared context.@Nullable public @Nullable FileSnapshot snapshot(long id, @Nullable @Nullable Collection<org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> optSearchPaths, @Nullable @Nullable IgniteBiClosure<String,CacheConfiguration,CacheConfiguration> c, boolean ignoreMissedClasses, @Nullable @Nullable SnapshotSecurityLevel securityLevel, boolean needDecryptKeys)
snapshot
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
id
- Id.optSearchPaths
- Opt search paths.c
- CacheConfig conversion closure.ignoreMissedClasses
- Ignore missed classes during metadata deserialization.securityLevel
- Snapshot security level, or null
for DISABLED which is default.needDecryptKeys
- True when encryption keys stored in snapshot needed to be decrypted, false otherwise.public void deleteSnapshot(long id, org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext ctx) throws IgniteCheckedException
deleteSnapshot
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
id
- Snapshot id.ctx
- Context.IgniteCheckedException
public boolean isCopyRequired(long snapshotId, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath targetDirectory) throws IgniteCheckedException
isCopyRequired
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotId
- Snapshot id.targetDirectory
- Target directory to perform copy to.IgniteCheckedException
- In case filesystem exception.public void copySnapshotEntirely(long snapshotId, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToCopy, org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext ctx, ExecutorService taskExecutor) throws IgniteCheckedException
copySnapshotEntirely
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotId
- Snapshot id.pathToCopy
- Path.ctx
- Context.taskExecutor
- Task executor.IgniteCheckedException
public void copySinglePartition(long snapshotId, int grpId, int partId, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToCopy, org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext context) throws IgniteCheckedException
copySinglePartition
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotId
- Snapshot id.grpId
- Group id.partId
- Partition id.pathToCopy
- Path where to copy.context
- Context.IgniteCheckedException
public void copyWalSegments(long snapshotId, Collection<File> segments, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath dir, org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext ctx) throws IgniteCheckedException
copyWalSegments
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotId
- Snapshot id.segments
- Wal segments.dir
- Target directory..ctx
- Snapshot operation context.IgniteCheckedException
public void copyMetadata(long snapshotId, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToMove, org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext context) throws IgniteCheckedException
copyMetadata
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotId
- Snapshot id.pathToMove
- Path.context
- Context.IgniteCheckedException
public void copyDigestRegistry(long snapshotId, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath file, org.gridgain.grid.internal.processors.cache.database.snapshot.SnapshotOperationContext context) throws IgniteCheckedException
copyDigestRegistry
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotId
- Snapshot id.file
- Path.context
- Context.IgniteCheckedException
public void startCopy(long snapshotId, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToCopy) throws IgniteCheckedException
startCopy
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotId
- Snapshot id.pathToCopy
- Target consistent id directory.IgniteCheckedException
- In case of failure to create copy marker file.public void finishCopy(long snapshotId, org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath pathToCopy)
finishCopy
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotId
- Snapshot id.pathToCopy
- Target consistent id directory.public <T extends org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> T generateSnapshotFolderPath(T snapshotBaseFolder, long id)
generateSnapshotFolderPath
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotBaseFolder
- Snapshot base folder.id
- Snapshot id.@NotNull public @NotNull org.gridgain.grid.internal.processors.cache.database.snapshot.file.FsSnapshotPath generateCurNodeSnapshotFolderPath(long id)
generateCurNodeSnapshotFolderPath
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
id
- Snapshot id.public <T extends org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> T generateCurNodeSnapshotFolderPathWithLabel(T snapshotBaseFolder, long id, String label)
generateCurNodeSnapshotFolderPathWithLabel
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotBaseFolder
- Where to generate folder.id
- Snapshot id to generate folder path.label
- Label for snapshot folder.@Nullable public <T extends org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> T findSnapshotDir(T snapshotBaseFolder, long id)
findSnapshotDir
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotBaseFolder
- Snapshot base folder.id
- Snapshot id to find folder.IgniteException
- If something happened.@Nullable public <T extends org.gridgain.grid.internal.processors.cache.database.snapshot.file.SnapshotPath> T findCurNodeSnapshotDir(T snapshotBaseFolder, long id)
org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
findCurNodeSnapshotDir
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
snapshotBaseFolder
- Snapshot base folder.id
- Snapshot id.@Nullable public @Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.FsSnapshotPath findLocalCurNodeSnapshotDir(long id)
findLocalCurNodeSnapshotDir
in interface org.gridgain.grid.internal.processors.cache.database.snapshot.DatabaseSnapshotSpi
id
- Snapshot id.@Nullable public @Nullable org.gridgain.grid.internal.processors.cache.database.snapshot.file.FsSnapshotPath findLocalSnapshotDir(long id) throws IgniteCheckedException
id
- Snapshot id.IgniteCheckedException
- If failed.public static String generateSnapshotDirName(long id, @Nullable @Nullable String lb)
id
- Snapshot id.lb
- Snapshot folder label.public static long extractIdFromSnapshotDirName(String dirName)
dirName
- Snapshot directory obtained from generateSnapshotDirName(long, java.lang.String)
.-1
if failed to get.
GridGain In-Memory Computing Platform : ver. 8.9.14 Release Date : November 5 2024