Class SnapshotTaker


  • public class SnapshotTaker
    extends java.lang.Object
    SnapshotTaker 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File getSnapshotFilePathForTsFile​(java.io.File tsFile, java.lang.String snapshotId)
      Construct the snapshot file path for a given tsfile, and will create the dir.
      boolean takeFullSnapshot​(java.lang.String snapshotDirPath, boolean flushBeforeSnapshot)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SnapshotTaker

        public SnapshotTaker​(DataRegion dataRegion)
    • Method Detail

      • getSnapshotFilePathForTsFile

        public java.io.File getSnapshotFilePathForTsFile​(java.io.File tsFile,
                                                         java.lang.String snapshotId)
                                                  throws java.io.IOException
        Construct 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 snapshot
        snapshotId - the id for current snapshot
        Returns:
        the File object of the snapshot file, and its parent directory will be created
        Throws:
        java.io.IOException