From 561b9650f58c79f377cf4a86e68ef7d7f0467bea Mon Sep 17 00:00:00 2001 From: sarvekshayr Date: Mon, 25 Nov 2024 13:30:36 +0530 Subject: [PATCH] Added OM repair command --- .../hadoop/ozone/repair/om/FSORepairCLI.java | 5 +- .../hadoop/ozone/repair/om/OMRepair.java | 53 +++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/OMRepair.java diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/FSORepairCLI.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/FSORepairCLI.java index 81c5f3b7160..ab24deb7237 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/FSORepairCLI.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/FSORepairCLI.java @@ -19,7 +19,6 @@ package org.apache.hadoop.ozone.repair.om; import org.apache.hadoop.hdds.cli.SubcommandWithParent; -import org.apache.hadoop.ozone.repair.OzoneRepair; import org.kohsuke.MetaInfServices; import picocli.CommandLine; @@ -37,7 +36,7 @@ public class FSORepairCLI implements Callable, SubcommandWithParent { @CommandLine.ParentCommand - private OzoneRepair parent; + private OMRepair parent; @CommandLine.Option(names = {"--db"}, required = true, @@ -85,6 +84,6 @@ public Void call() throws Exception { @Override public Class getParentType() { - return OzoneRepair.class; + return OMRepair.class; } } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/OMRepair.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/OMRepair.java new file mode 100644 index 00000000000..6682ccda747 --- /dev/null +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/OMRepair.java @@ -0,0 +1,53 @@ +/* + * 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.repair.om; + +import org.apache.hadoop.hdds.cli.GenericCli; +import org.apache.hadoop.hdds.cli.SubcommandWithParent; +import org.apache.hadoop.ozone.repair.OzoneRepair; +import org.kohsuke.MetaInfServices; +import picocli.CommandLine; + +import java.util.concurrent.Callable; + +/** + * Ozone Repair CLI for OM. + */ +@CommandLine.Command(name = "om", + description = "Operational tool to repair OM.") +@MetaInfServices(SubcommandWithParent.class) +public class OMRepair implements Callable, SubcommandWithParent { + + @CommandLine.Spec + private CommandLine.Model.CommandSpec spec; + + @CommandLine.ParentCommand + private OzoneRepair parent; + + @Override + public Void call() { + GenericCli.missingSubcommand(spec); + return null; + } + + @Override + public Class getParentType() { + return OzoneRepair.class; + } +}