Class SnapshotUtils

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

public final class SnapshotUtils extends Object
Util class for snapshot diff APIs.
  • Method Details

    • getSnapshotInfo

      public static org.apache.hadoop.ozone.om.helpers.SnapshotInfo getSnapshotInfo(OzoneManager ozoneManager, String volumeName, String bucketName, String snapshotName) throws IOException
      Throws:
      IOException
    • getSnapshotInfo

      public static org.apache.hadoop.ozone.om.helpers.SnapshotInfo getSnapshotInfo(OzoneManager ozoneManager, String snapshotKey) throws IOException
      Throws:
      IOException
    • getSnapshotInfo

      public static org.apache.hadoop.ozone.om.helpers.SnapshotInfo getSnapshotInfo(OzoneManager ozoneManager, SnapshotChainManager chainManager, UUID snapshotId) throws IOException
      Throws:
      IOException
    • dropColumnFamilyHandle

      public static void dropColumnFamilyHandle(org.apache.hadoop.hdds.utils.db.managed.ManagedRocksDB rocksDB, org.rocksdb.ColumnFamilyHandle columnFamilyHandle)
    • checkSnapshotDirExist

      public static void checkSnapshotDirExist(File checkpoint) throws IOException
      Throws OMException TIMEOUT if snapshot directory does not exist.
      Parameters:
      checkpoint - Snapshot checkpoint directory
      Throws:
      IOException
    • checkSnapshotActive

      public static void checkSnapshotActive(OzoneManager ozoneManager, String snapshotTableKey) throws IOException
      Throws OMException FILE_NOT_FOUND if snapshot is not in active status.
      Parameters:
      snapshotTableKey - snapshot table key
      Throws:
      IOException
    • checkSnapshotActive

      public static void checkSnapshotActive(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapInfo, boolean skipCheck) throws org.apache.hadoop.ozone.om.exceptions.OMException
      Throws:
      org.apache.hadoop.ozone.om.exceptions.OMException
    • getNextSnapshot

      public static org.apache.hadoop.ozone.om.helpers.SnapshotInfo getNextSnapshot(OzoneManager ozoneManager, SnapshotChainManager chainManager, org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapInfo) throws IOException
      Get the next snapshot in the snapshot chain.
      Throws:
      IOException
    • getPreviousSnapshot

      public static org.apache.hadoop.ozone.om.helpers.SnapshotInfo getPreviousSnapshot(OzoneManager ozoneManager, SnapshotChainManager chainManager, org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapInfo) throws IOException
      Get the previous snapshot in the snapshot chain.
      Throws:
      IOException
    • getPreviousSnapshotId

      public static UUID getPreviousSnapshotId(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapInfo, SnapshotChainManager chainManager) throws IOException
      Get the previous snapshot in the snapshot chain.
      Throws:
      IOException
    • getColumnFamilyToKeyPrefixMap

      public static Map<String,String> getColumnFamilyToKeyPrefixMap(org.apache.hadoop.ozone.om.OMMetadataManager omMetadataManager, String volumeName, String bucketName) throws IOException
      Return a map column family to prefix for the keys in the table for the given volume and bucket. Column families, map is returned for, are keyTable, dirTable and fileTable.
      Throws:
      IOException
    • createMergedRepeatedOmKeyInfoFromDeletedTableEntry

      public static org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo createMergedRepeatedOmKeyInfoFromDeletedTableEntry(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SnapshotMoveKeyInfos snapshotMoveKeyInfos, long bucketId, org.apache.hadoop.ozone.om.OMMetadataManager metadataManager) throws IOException
      Returns merged repeatedKeyInfo entry with the existing deleted entry in the table.
      Parameters:
      snapshotMoveKeyInfos - keyInfos to be added.
      metadataManager - metadataManager for a store.
      Returns:
      RepeatedOmKeyInfo
      Throws:
      IOException
    • getLatestSnapshotInfo

      public static org.apache.hadoop.ozone.om.helpers.SnapshotInfo getLatestSnapshotInfo(String volumeName, String bucketName, OzoneManager ozoneManager, SnapshotChainManager snapshotChainManager) throws IOException
      Throws:
      IOException
    • getLatestPathSnapshotId

      public static UUID getLatestPathSnapshotId(String volumeName, String bucketName, SnapshotChainManager snapshotChainManager) throws IOException
      Throws:
      IOException
    • validatePreviousSnapshotId

      public static void validatePreviousSnapshotId(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapshotInfo, SnapshotChainManager snapshotChainManager, UUID expectedPreviousSnapshotId) throws IOException
      Throws:
      IOException
    • isBlockLocationInfoSame

      public static boolean isBlockLocationInfoSame(org.apache.hadoop.ozone.om.helpers.OmKeyInfo prevKeyInfo, org.apache.hadoop.ozone.om.helpers.OmKeyInfo deletedKeyInfo)
      Compares the block location info of 2 key info.
      Returns:
      true if block locations are same else false.