sumitagrawl commented on code in PR #7465:
URL: https://github.com/apache/ozone/pull/7465#discussion_r1867338603


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/KeyPathRetriever.java:
##########
@@ -0,0 +1,301 @@
+/*
+ * 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.debug;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.stream.Stream;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.hadoop.hdds.cli.SubcommandWithParent;
+import org.apache.hadoop.hdds.conf.ConfigurationSource;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+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.LongCodec;
+import org.apache.hadoop.hdds.utils.db.StringCodec;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.hadoop.hdds.utils.db.Table.KeyValue;
+import org.apache.hadoop.hdds.utils.db.TableIterator;
+import org.apache.hadoop.ozone.om.OMMetadataManager;
+import org.apache.hadoop.ozone.om.OmMetadataManagerImpl;
+import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
+import org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo;
+import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
+import org.kohsuke.MetaInfServices;
+import picocli.CommandLine;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import static org.apache.hadoop.ozone.OzoneConsts.OM_KEY_PREFIX;
+
+/**
+ * Tool that retrieve key full path from OM db file table with pattern match.
+ */
[email protected](
+    name = "retrieve-key-fullpath",
+    description = "retrieve full key path with matching criteria")
+@MetaInfServices(SubcommandWithParent.class)
+public class KeyPathRetriever implements Callable<Void>, SubcommandWithParent {
+  private static final String DIRTREEDBNAME = "omdirtree.db";
+  private static final DBColumnFamilyDefinition<Long, String> 
DIRTREE_COLUMN_FAMILY
+      = new DBColumnFamilyDefinition<>("dirTreeTable", LongCodec.get(), 
StringCodec.get());
+
+  @CommandLine.Spec
+  private static CommandLine.Model.CommandSpec spec;
+
+  @CommandLine.Option(names = {"--db"},
+      required = true,
+      description = "Database File")
+  private String dbFile;
+
+  @CommandLine.Option(names = {"--containers"},
+      required = false,
+      description = "Comma separated Container Ids")
+  private String strContainerIds;
+
+  @CommandLine.Option(names = {"--container-file"},
+      required = false,
+      description = "file with container id in new line")
+  private String containerFileName;
+
+  @CommandLine.Option(names = {"--out", "-o"},
+      required = false,
+      description = "out file name")
+  private String fileName;

Review Comment:
   in this case, normal system.out should not be used for info / log info, only 
`system.err` to be used. With this change, it can be done.
   will do above change and remove --out.



-- 
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]

Reply via email to