devmadhuu commented on code in PR #6272: URL: https://github.com/apache/ozone/pull/6272#discussion_r1540581281
########## hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconScmMetadataManagerImpl.java: ########## @@ -0,0 +1,219 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.scm; + +import org.apache.commons.io.FileUtils; +import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.apache.hadoop.hdds.scm.ha.SequenceIdGenerator; +import org.apache.hadoop.hdds.scm.metadata.SCMMetadataStoreImpl; +import org.apache.hadoop.hdds.scm.server.OzoneStorageContainerManager; +import org.apache.hadoop.hdds.utils.db.DBColumnFamilyDefinition; +import org.apache.hadoop.hdds.utils.db.DBStore; +import org.apache.hadoop.hdds.utils.db.DBStoreBuilder; +import org.apache.hadoop.hdds.utils.db.RDBStore; +import org.apache.hadoop.hdds.utils.db.Table; +import org.apache.hadoop.ozone.recon.ReconUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; +import javax.inject.Singleton; +import java.io.File; +import java.io.IOException; + +import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_SCM_SNAPSHOT_DB; +import static org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_SCM_DB_DIR; + +/** + * Recon's implementation of the SCM Metadata manager. By extending and + * relying on the SCMMetadataStoreImpl, we can make sure all changes made to + * schema in SCM will be automatically picked up by Recon. + */ +@Singleton +public class ReconScmMetadataManagerImpl extends SCMMetadataStoreImpl + implements ReconScmMetadataManager { + + private static final Logger LOG = + LoggerFactory.getLogger(ReconScmMetadataManagerImpl.class); + + private OzoneConfiguration ozoneConfiguration; + private ReconUtils reconUtils; + private OzoneStorageContainerManager ozoneStorageContainerManager; + private SequenceIdGenerator sequenceIdGen; + private ReconNodeManager nodeManager; + + @Inject + public ReconScmMetadataManagerImpl(OzoneConfiguration configuration, + ReconUtils reconUtils) { + this.reconUtils = reconUtils; + this.ozoneConfiguration = configuration; + } + + @Override + public void start(OzoneConfiguration configuration) throws IOException { + LOG.info("Starting ReconScmMetadataManagerImpl..."); + File reconDbDir = + reconUtils.getReconDbDir(configuration, OZONE_RECON_SCM_DB_DIR); + File lastKnownSCMSnapshot = + reconUtils.getLastKnownDB(reconDbDir, RECON_SCM_SNAPSHOT_DB); + if (lastKnownSCMSnapshot != null) { + LOG.info("Last known snapshot for SCM : {}", lastKnownSCMSnapshot.getAbsolutePath()); + } + } + + private DBStore createDBAndAddSCMTablesAndCodecs(File dbFile, Review Comment: Ok, will add, normally for private methods, we don't add javadoc. but will add. -- 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]
