Class ReclaimableFilter<V>
java.lang.Object
org.apache.hadoop.ozone.om.snapshot.filter.ReclaimableFilter<V>
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String,V>, Boolean, IOException>
- Direct Known Subclasses:
ReclaimableDirFilter,ReclaimableKeyFilter,ReclaimableRenameEntryFilter
public abstract class ReclaimableFilter<V>
extends Object
implements org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String,V>,Boolean,IOException>, Closeable
This class is responsible for opening last N snapshot given a snapshot metadata manager or AOS metadata manager by
acquiring a lock.
-
Constructor Summary
ConstructorsConstructorDescriptionReclaimableFilter(OzoneManager ozoneManager, OmSnapshotManager omSnapshotManager, SnapshotChainManager snapshotChainManager, org.apache.hadoop.ozone.om.helpers.SnapshotInfo currentSnapshotInfo, KeyManager keyManager, org.apache.hadoop.ozone.om.lock.IOzoneManagerLock lock, int numberOfPreviousSnapshotsFromChain) Filter to return deleted keys/directories which are reclaimable based on their presence in previous snapshot in the snapshot chain. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected org.apache.hadoop.ozone.om.helpers.OmBucketInfoprotected abstract StringgetBucketName(org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, V> keyValue) protected KeyManagerprotected OzoneManagerprotected org.apache.ratis.util.function.UncheckedAutoCloseableSupplier<OmSnapshot> getPreviousOmSnapshot(int index) protected org.apache.hadoop.ozone.om.helpers.SnapshotInfogetPreviousSnapshotInfo(int index) protected Longprotected abstract StringgetVolumeName(org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, V> keyValue) protected abstract BooleanisReclaimable(org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, V> keyValue)
-
Constructor Details
-
ReclaimableFilter
public ReclaimableFilter(OzoneManager ozoneManager, OmSnapshotManager omSnapshotManager, SnapshotChainManager snapshotChainManager, org.apache.hadoop.ozone.om.helpers.SnapshotInfo currentSnapshotInfo, KeyManager keyManager, org.apache.hadoop.ozone.om.lock.IOzoneManagerLock lock, int numberOfPreviousSnapshotsFromChain) Filter to return deleted keys/directories which are reclaimable based on their presence in previous snapshot in the snapshot chain.- Parameters:
ozoneManager- : Ozone Manager instanceomSnapshotManager- : OmSnapshot Manager of OM instance.snapshotChainManager- : snapshot chain manager of OM instance.currentSnapshotInfo- : If null the deleted keys in Active Metadata manager needs to be processed, hence the the reference for the key in the latest snapshot in the snapshot chain needs to be checked.keyManager- : KeyManager corresponding to snapshot or Active Metadata Manager.lock- : Lock Manager for Active OM.numberOfPreviousSnapshotsFromChain- : number of previous snapshots to be initialized.
-
-
Method Details
-
apply
public Boolean apply(org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, V> keyValue) throws IOException- Specified by:
applyin interfaceorg.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String,V>, Boolean, IOException> - Throws:
IOException
-
getVolumeName
protected abstract String getVolumeName(org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, V> keyValue) throws IOException- Throws:
IOException
-
getBucketName
protected abstract String getBucketName(org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, V> keyValue) throws IOException- Throws:
IOException
-
isReclaimable
protected abstract Boolean isReclaimable(org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, V> keyValue) throws IOException- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getPreviousOmSnapshot
protected org.apache.ratis.util.function.UncheckedAutoCloseableSupplier<OmSnapshot> getPreviousOmSnapshot(int index) -
getKeyManager
-
getVolumeId
-
getBucketInfo
protected org.apache.hadoop.ozone.om.helpers.OmBucketInfo getBucketInfo() -
getPreviousSnapshotInfo
protected org.apache.hadoop.ozone.om.helpers.SnapshotInfo getPreviousSnapshotInfo(int index) -
getOzoneManager
-