Class OmSnapshotUtils

java.lang.Object
org.apache.hadoop.ozone.om.snapshot.OmSnapshotUtils

public final class OmSnapshotUtils extends Object
Ozone Manager Snapshot Utilities.
  • Field Details

  • Method Details

    • truncateFileName

      public static String truncateFileName(int truncateLength, Path file)
      Get the filename without the introductory metadata directory.
      Parameters:
      truncateLength - Length to remove.
      file - File to remove prefix from.
      Returns:
      Truncated string.
    • getINode

      public static Object getINode(Path file) throws IOException
      Get the INode for file.
      Parameters:
      file - File whose INode is to be retrieved.
      Returns:
      INode for file.
      Throws:
      IOException
    • createHardLinkList

      public static Path createHardLinkList(int truncateLength, Map<Path,Path> hardLinkFiles) throws IOException
      Create file of links to add to tarball. Format of entries are either: dir1/fileTo fileFrom for files in active db or: dir1/fileTo dir2/fileFrom for files in another directory, (either another snapshot dir or sst compaction backup directory)
      Parameters:
      truncateLength - - Length of initial path to trim in file path.
      hardLinkFiles - - Map of link->file paths.
      Returns:
      Path to the file of links created.
      Throws:
      IOException
    • createHardLinks

      public static void createHardLinks(Path dbPath) throws IOException
      Create hard links listed in OM_HARDLINK_FILE.
      Parameters:
      dbPath - Path to db to have links created.
      Throws:
      IOException
    • linkFiles

      public static void linkFiles(File oldDir, File newDir) throws IOException
      Link each of the files in oldDir to newDir.
      Parameters:
      oldDir - The dir to create links from.
      newDir - The dir to create links to.
      Throws:
      IOException