Package org.apache.hadoop.ozone.om
Class SnapshotChainManager
java.lang.Object
org.apache.hadoop.ozone.om.SnapshotChainManager
This class is used for creating and accessing Snapshot Chains.
The snapshot chain maintains the in-memory sequence of snapshots created in chronological order. There are two such snapshots maintained i.) Path based snapshot chain, sequence of snapshots created for a given /volume/bucket ii.) Global snapshot chain, sequence of all snapshots created in order
On start, the snapshot chains are initialized from the on disk SnapshotInfoTable from the OM RocksDB.
-
Constructor Summary
ConstructorsConstructorDescriptionSnapshotChainManager(org.apache.hadoop.ozone.om.OMMetadataManager metadataManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSnapshot(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapshotInfo) Add snapshot to snapshot chain.booleandeleteSnapshot(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapshotInfo) Delete snapshot from snapshot chain.Get latest global snapshot in snapshot chain.getLatestPathSnapshotId(String snapshotPath) Get latest path snapshot in snapshot chain.Get oldest of global snapshot in snapshot chain.getSnapshotChainPath(String path) getTableKey(UUID snapshotId) booleanhasNextGlobalSnapshot(UUID snapshotId) Returns true if snapshot from given snapshotId has a next snapshot entry in the global snapshot chain.booleanhasNextPathSnapshot(String snapshotPath, UUID snapshotId) Returns true if snapshot path from given snapshotId has a next snapshot entry in the path snapshot chain.booleanhasPreviousGlobalSnapshot(UUID snapshotId) Returns true if snapshot from given snapshotId has a previous snapshot entry in the global snapshot chain.booleanhasPreviousPathSnapshot(String snapshotPath, UUID snapshotId) Returns true if snapshot path from given snapshotId has a previous snapshot entry in the path snapshot chain.booleaniterator(boolean reverse) nextGlobalSnapshot(UUID snapshotId) Get next global snapshot in snapshot chain from given snapshot.nextPathSnapshot(String snapshotPath, UUID snapshotId) Get next path snapshot in snapshot chain from given snapshot.previousGlobalSnapshot(UUID snapshotId) Get previous global snapshot in snapshot chain from given snapshot.previousPathSnapshot(String snapshotPath, UUID snapshotId) Get previous path snapshot in snapshot chain from given snapshot.voidremoveFromSnapshotIdToTable(UUID snapshotId) Remove the snapshot from snapshotIdToSnapshotTableKey map.voidupdateSnapshot(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapshotInfo) Update snapshot chain when snapshot changes (e.g. renamed).
-
Constructor Details
-
SnapshotChainManager
public SnapshotChainManager(org.apache.hadoop.ozone.om.OMMetadataManager metadataManager)
-
-
Method Details
-
addSnapshot
public void addSnapshot(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapshotInfo) throws IOException Add snapshot to snapshot chain.- Throws:
IOException
-
updateSnapshot
public void updateSnapshot(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapshotInfo) Update snapshot chain when snapshot changes (e.g. renamed). -
deleteSnapshot
public boolean deleteSnapshot(org.apache.hadoop.ozone.om.helpers.SnapshotInfo snapshotInfo) throws IOException Delete snapshot from snapshot chain.- Throws:
IOException
-
removeFromSnapshotIdToTable
Remove the snapshot from snapshotIdToSnapshotTableKey map.- Throws:
IOException
-
getLatestGlobalSnapshotId
Get latest global snapshot in snapshot chain.- Throws:
IOException
-
getOldestGlobalSnapshotId
Get oldest of global snapshot in snapshot chain.- Throws:
IOException
-
iterator
- Throws:
IOException
-
getLatestPathSnapshotId
Get latest path snapshot in snapshot chain.- Throws:
IOException
-
hasNextGlobalSnapshot
Returns true if snapshot from given snapshotId has a next snapshot entry in the global snapshot chain.- Throws:
IOException
-
nextGlobalSnapshot
Get next global snapshot in snapshot chain from given snapshot.- Throws:
IOException
-
hasPreviousGlobalSnapshot
Returns true if snapshot from given snapshotId has a previous snapshot entry in the global snapshot chain.- Throws:
IOException
-
previousGlobalSnapshot
Get previous global snapshot in snapshot chain from given snapshot.- Throws:
IOException
-
hasNextPathSnapshot
Returns true if snapshot path from given snapshotId has a next snapshot entry in the path snapshot chain.- Throws:
IOException
-
nextPathSnapshot
Get next path snapshot in snapshot chain from given snapshot.- Throws:
IOException
-
hasPreviousPathSnapshot
Returns true if snapshot path from given snapshotId has a previous snapshot entry in the path snapshot chain.- Throws:
IOException
-
previousPathSnapshot
Get previous path snapshot in snapshot chain from given snapshot.- Throws:
IOException
-
getTableKey
-
getSnapshotChainPath
- Throws:
IOException
-
getGlobalSnapshotChain
- Throws:
IOException
-
getSnapshotChainByPath
public Map<String,LinkedHashMap<UUID, getSnapshotChainByPath() throws IOExceptionSnapshotChainInfo>> - Throws:
IOException
-
isSnapshotChainCorrupted
public boolean isSnapshotChainCorrupted()
-