swamirishi commented on code in PR #8053: URL: https://github.com/apache/ozone/pull/8053#discussion_r2069340206
########## hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/filter/ReclaimableFilter.java: ########## @@ -0,0 +1,247 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.ozone.om.snapshot.filter; + +import java.io.Closeable; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.UUID; +import org.apache.hadoop.hdds.utils.IOUtils; +import org.apache.hadoop.hdds.utils.db.Table; +import org.apache.hadoop.ozone.om.KeyManager; +import org.apache.hadoop.ozone.om.OmSnapshot; +import org.apache.hadoop.ozone.om.OmSnapshotManager; +import org.apache.hadoop.ozone.om.OzoneManager; +import org.apache.hadoop.ozone.om.SnapshotChainManager; +import org.apache.hadoop.ozone.om.helpers.OmBucketInfo; +import org.apache.hadoop.ozone.om.helpers.SnapshotInfo; +import org.apache.hadoop.ozone.om.lock.IOzoneManagerLock; +import org.apache.hadoop.ozone.om.lock.OzoneManagerLock; +import org.apache.hadoop.ozone.om.snapshot.MultiSnapshotLocks; +import org.apache.hadoop.ozone.om.snapshot.ReferenceCounted; +import org.apache.hadoop.ozone.om.snapshot.SnapshotUtils; +import org.apache.hadoop.ozone.util.CheckedFunction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class is responsible for opening last N snapshot given a snapshot metadata manager or AOS metadata manager by + * acquiring a lock. + */ +public abstract class ReclaimableFilter<V> implements CheckedFunction<Table.KeyValue<String, V>, + Boolean, IOException>, Closeable { + + private static final Logger LOG = LoggerFactory.getLogger(ReclaimableFilter.class); + + private final OzoneManager ozoneManager; + private final SnapshotInfo currentSnapshotInfo; + private final OmSnapshotManager omSnapshotManager; + private final SnapshotChainManager snapshotChainManager; + private final List<SnapshotInfo> tmpValidationSnapshotInfos; + private final List<UUID> lockedSnapshotIds; + private final List<SnapshotInfo> previousSnapshotInfos; + private final List<ReferenceCounted<OmSnapshot>> previousOmSnapshots; + private final MultiSnapshotLocks snapshotIdLocks; + private Long volumeId; + private OmBucketInfo bucketInfo; + private final KeyManager keyManager; + private final int numberOfPreviousSnapshotsFromChain; + + /** + * Filter to return deleted keys/directories which are reclaimable based on their presence in previous snapshot in + * the snapshot chain. + * + * @param ozoneManager : Ozone Manager instance + * @param omSnapshotManager : OmSnapshot Manager of OM instance. + * @param snapshotChainManager : snapshot chain manager of OM instance. + * @param currentSnapshotInfo : If null the deleted keys in Active Metadata manager needs to be processed, hence the + * latest snapshot in the snapshot chain corresponding to bucket key needs to be + * processed. + * @param keyManager : KeyManager corresponding to snapshot or Active Metadata Manager. + * @param lock : Lock for Active OM. Review Comment: You are right it is the lock manager for OM -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org