Class SnapshotTaker
- java.lang.Object
-
- org.apache.iotdb.db.engine.snapshot.SnapshotTaker
-
public class SnapshotTaker extends java.lang.ObjectSnapshotTaker takes data snapshot for a DataRegion in one time. It does so by creating hard link for files or copying them. SnapshotTaker supports two different ways of snapshot: Full Snapshot and Incremental Snapshot. The former takes a snapshot for all files in an empty directory, and the latter takes a snapshot based on the snapshot that took before.
-
-
Constructor Summary
Constructors Constructor Description SnapshotTaker(DataRegion dataRegion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilegetSnapshotFilePathForTsFile(java.io.File tsFile, java.lang.String snapshotId)Construct the snapshot file path for a given tsfile, and will create the dir.booleantakeFullSnapshot(java.lang.String snapshotDirPath, boolean flushBeforeSnapshot)
-
-
-
Constructor Detail
-
SnapshotTaker
public SnapshotTaker(DataRegion dataRegion)
-
-
Method Detail
-
takeFullSnapshot
public boolean takeFullSnapshot(java.lang.String snapshotDirPath, boolean flushBeforeSnapshot) throws DirectoryNotLegalException, java.io.IOException- Throws:
DirectoryNotLegalExceptionjava.io.IOException
-
getSnapshotFilePathForTsFile
public java.io.File getSnapshotFilePathForTsFile(java.io.File tsFile, java.lang.String snapshotId) throws java.io.IOExceptionConstruct the snapshot file path for a given tsfile, and will create the dir. Eg, given a tsfile in /data/iotdb/data/sequence/root.testsg/1/0/1-1-0-0.tsfile, with snapshotId "sm123", the snapshot location will be /data/iotdb/data/snapshot/sm123/root.testsg/1/0/1-1-0-0.tsfile- Parameters:
tsFile- tsfile to be taken a snapshotsnapshotId- the id for current snapshot- Returns:
- the File object of the snapshot file, and its parent directory will be created
- Throws:
java.io.IOException
-
-