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 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 instance
      omSnapshotManager - : 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:
      apply in interface org.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

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getPreviousOmSnapshot

      protected org.apache.ratis.util.function.UncheckedAutoCloseableSupplier<OmSnapshot> getPreviousOmSnapshot(int index)
    • getKeyManager

      protected KeyManager getKeyManager()
    • getVolumeId

      protected Long getVolumeId()
    • getBucketInfo

      protected org.apache.hadoop.ozone.om.helpers.OmBucketInfo getBucketInfo()
    • getPreviousSnapshotInfo

      protected org.apache.hadoop.ozone.om.helpers.SnapshotInfo getPreviousSnapshotInfo(int index)
    • getOzoneManager

      protected OzoneManager getOzoneManager()