smengcl commented on code in PR #9155: URL: https://github.com/apache/ozone/pull/9155#discussion_r2487679770
########## hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/ozone/admin/om/snapshot/DefragSubCommand.java: ########## @@ -0,0 +1,121 @@ +/* + * 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.admin.om.snapshot; + +import java.io.IOException; +import java.util.concurrent.Callable; +import org.apache.hadoop.hdds.cli.HddsVersionProvider; +import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.apache.hadoop.ozone.admin.om.OMAdmin; +import org.apache.hadoop.ozone.om.helpers.OMNodeDetails; +import org.apache.hadoop.ozone.om.protocolPB.OMAdminProtocolClientSideImpl; +import org.apache.hadoop.security.UserGroupInformation; +import picocli.CommandLine; + +/** + * Handler of ozone admin om snapshot defrag command. + */ [email protected]( + name = "defrag", + description = "Triggers the Snapshot Defragmentation Service to run " + + "immediately. This command manually initiates the snapshot " + + "defragmentation process which compacts snapshot data and removes " + + "fragmentation to improve storage efficiency. " + + "This command works only on OzoneManager HA cluster.", + mixinStandardHelpOptions = true, + versionProvider = HddsVersionProvider.class +) +public class DefragSubCommand implements Callable<Void> { + + @CommandLine.ParentCommand + private SnapshotSubCommand parent; + + @CommandLine.Option( + names = {"-id", "--service-id"}, + description = "Ozone Manager Service ID" + ) + private String omServiceId; + + @CommandLine.Option( + names = {"--node-id"}, + description = "NodeID of the OM to trigger snapshot defragmentation on.", + required = false Review Comment: This has to be specified, with the current framework of how OMNodeDetails is retrieved. It won't select OM leader as I initially expected. So I added that null check. -- 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]
