Tejaskriya commented on code in PR #8016: URL: https://github.com/apache/ozone/pull/8016#discussion_r1990557818
########## hadoop-hdds/rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/compaction/log/PopulateCompactionTable.java: ########## @@ -0,0 +1,240 @@ +/* + * 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.ozone.compaction.log; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import com.google.common.base.Preconditions; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.hadoop.hdds.utils.db.managed.ManagedOptions; +import org.apache.hadoop.hdds.utils.db.managed.ManagedRocksDB; +import org.apache.hadoop.hdds.utils.db.managed.ManagedSstFileReader; +import org.rocksdb.ColumnFamilyHandle; +import org.rocksdb.RocksDBException; +import org.rocksdb.TableProperties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Utility methods to populate compactionLogTable from a compaction-log file. + */ +public final class PopulateCompactionTable { + private static final Logger LOG = + LoggerFactory.getLogger(PopulateCompactionTable.class); + + /** + * Used during DAG construction. + */ + private long reconstructionSnapshotCreationTime; + private String reconstructionCompactionReason; + private final String compactionLogDir; + private ManagedRocksDB activeRocksDB; + private ColumnFamilyHandle compactionLogTableCFHandle; + + public PopulateCompactionTable(String compactLogDir, ManagedRocksDB db, ColumnFamilyHandle cf) { + compactionLogDir = compactLogDir; + activeRocksDB = db; + compactionLogTableCFHandle = cf; + reconstructionSnapshotCreationTime = 0L; + reconstructionCompactionReason = null; + } + + public void setActiveRocksDB(ManagedRocksDB activeRocksDB) { + this.activeRocksDB = activeRocksDB; + } + + public void setCompactionLogTableCFHandle(ColumnFamilyHandle compactionLogTableCFHandle) { + this.compactionLogTableCFHandle = compactionLogTableCFHandle; + } + + public void addEntriesFromLogFilesToDagAndCompactionLogTable() { Review Comment: If we want to keep the command compatible with older metadata, we can use this with the command too. Might give some more flexibility. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
