Tejaskriya commented on code in PR #8409: URL: https://github.com/apache/ozone/pull/8409#discussion_r2077097190
########## hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/logs/container/ListContainers.java: ########## @@ -57,7 +60,13 @@ public Void call() throws Exception { ContainerDatanodeDatabase cdd = new ContainerDatanodeDatabase(dbPath.toString()); - cdd.listContainersByState(state.name(), listOptions.getLimit()); + if (duplicateOpen) { + cdd.findDuplicateOpenContainer(); + } else if (state != null) { + cdd.listContainersByState(state.name(), listOptions.getLimit()); + } else { + err().println("Please provide either a container state or use --double-open."); + } Review Comment: After adding the arg group, this implementation also would change to be a little simpler ########## hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/logs/container/ListContainers.java: ########## @@ -37,13 +37,16 @@ public class ListContainers extends AbstractSubcommand implements Callable<Void> { @CommandLine.Option(names = {"--state"}, - description = "Life cycle state of the container.", - required = true) + description = "Life cycle state of the container.") private HddsProtos.LifeCycleState state; @CommandLine.Mixin private ListOptions listOptions; + @CommandLine.Option(names = {"--duplicate-open"}, + description = "List all the containers which have duplicate open states.") + private boolean duplicateOpen; + Review Comment: You can create an argument group, as either one of these options must be passed. You can refer to this example: https://github.com/apache/ozone/pull/8154/files#diff-0d3a4ca03554734dec76f499f5a9d2438c88f6a989334a28dbb4350c9d19d298R208 for the implementation -- 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