Tejaskriya commented on code in PR #8016: URL: https://github.com/apache/ozone/pull/8016#discussion_r2071074789
########## hadoop-hdds/rocksdb-checkpoint-differ/src/main/java/org/apache/ozone/rocksdiff/CompactionDag.java: ########## @@ -0,0 +1,156 @@ +/* + * 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.rocksdiff; + +import com.google.common.graph.GraphBuilder; +import com.google.common.graph.MutableGraph; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import org.apache.ozone.compaction.log.CompactionFileInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Wrapper class storing DAGs of SST files for tracking compactions. + */ +public class CompactionDag { + private static final Logger LOG = LoggerFactory.getLogger(CompactionDag.class); + + private final ConcurrentMap<String, CompactionNode> compactionNodeMap = new ConcurrentHashMap<>(); + private final MutableGraph<CompactionNode> forwardCompactionDAG = GraphBuilder.directed().build(); + private final MutableGraph<CompactionNode> backwardCompactionDAG = GraphBuilder.directed().build(); + + private CompactionNode addNodeToDAG(String file, long seqNum, String startKey, String endKey, String columnFamily) { + CompactionNode fileNode = new CompactionNode(file, seqNum, startKey, endKey, columnFamily); + backwardCompactionDAG.addNode(fileNode); + forwardCompactionDAG.addNode(fileNode); + return fileNode; + } + + /** + * Populate the compaction DAG with input and output SST files lists. + * + * @param inputFiles List of compaction input files. + * @param outputFiles List of compaction output files. + * @param seqNum DB transaction sequence number. + */ + public void populateCompactionDAG(List<CompactionFileInfo> inputFiles, + List<CompactionFileInfo> outputFiles, + long seqNum) { Review Comment: Got it, I have changed it in all the files that are being touched in the PR. -- 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]
