Class SnapshotUtils
java.lang.Object
org.apache.hadoop.ozone.om.snapshot.SnapshotUtils
Util class for snapshot diff APIs.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckSnapshotActive(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapInfo, boolean skipCheck) static voidcheckSnapshotActive(OzoneManager ozoneManager, String snapshotTableKey) Throws OMException FILE_NOT_FOUND if snapshot is not in active status.static voidcheckSnapshotDirExist(File checkpoint) Throws OMException TIMEOUT if snapshot directory does not exist.static org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfocreateMergedRepeatedOmKeyInfoFromDeletedTableEntry(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.SnapshotMoveKeyInfos snapshotMoveKeyInfos, long bucketId, org.apache.hadoop.ozone.om.OMMetadataManager metadataManager) Returns merged repeatedKeyInfo entry with the existing deleted entry in the table.static voiddropColumnFamilyHandle(org.apache.hadoop.hdds.utils.db.managed.ManagedRocksDB rocksDB, org.rocksdb.ColumnFamilyHandle columnFamilyHandle) getColumnFamilyToKeyPrefixMap(org.apache.hadoop.ozone.om.OMMetadataManager omMetadataManager, String volumeName, String bucketName) Return a map column family to prefix for the keys in the table for the given volume and bucket.static UUIDgetLatestPathSnapshotId(String volumeName, String bucketName, SnapshotChainManager snapshotChainManager) static org.apache.hadoop.ozone.om.helpers.SnapshotInfogetLatestSnapshotInfo(String volumeName, String bucketName, OzoneManager ozoneManager, SnapshotChainManager snapshotChainManager) static org.apache.hadoop.ozone.om.helpers.SnapshotInfogetNextSnapshot(OzoneManager ozoneManager, SnapshotChainManager chainManager, org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapInfo) Get the next snapshot in the snapshot chain.static org.apache.hadoop.ozone.om.helpers.SnapshotInfogetPreviousSnapshot(OzoneManager ozoneManager, SnapshotChainManager chainManager, org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapInfo) Get the previous snapshot in the snapshot chain.static UUIDgetPreviousSnapshotId(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapInfo, SnapshotChainManager chainManager) Get the previous snapshot in the snapshot chain.static org.apache.hadoop.ozone.om.helpers.SnapshotInfogetSnapshotInfo(OzoneManager ozoneManager, String snapshotKey) static org.apache.hadoop.ozone.om.helpers.SnapshotInfogetSnapshotInfo(OzoneManager ozoneManager, String volumeName, String bucketName, String snapshotName) static org.apache.hadoop.ozone.om.helpers.SnapshotInfogetSnapshotInfo(OzoneManager ozoneManager, SnapshotChainManager chainManager, UUID snapshotId) static booleanisBlockLocationInfoSame(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.static voidvalidatePreviousSnapshotId(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapshotInfo, SnapshotChainManager snapshotChainManager, UUID expectedPreviousSnapshotId)
-
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
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.
-