ptlrs commented on code in PR #7748: URL: https://github.com/apache/ozone/pull/7748#discussion_r1989906510
########## hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/replicas/ReplicasVerify.java: ########## @@ -0,0 +1,134 @@ +/* + * 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.replicas; + +import java.io.IOException; +import java.util.Iterator; +import org.apache.hadoop.hdds.scm.cli.ScmOption; +import org.apache.hadoop.ozone.client.ObjectStore; +import org.apache.hadoop.ozone.client.OzoneBucket; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientException; +import org.apache.hadoop.ozone.client.OzoneKey; +import org.apache.hadoop.ozone.client.OzoneVolume; +import org.apache.hadoop.ozone.shell.Handler; +import org.apache.hadoop.ozone.shell.OzoneAddress; +import org.apache.hadoop.ozone.shell.Shell; +import picocli.CommandLine; + +/** + * Verify replicas command. + */ + [email protected]( + name = "verify", + description = "Run various debug tools to verify data across replicas") +public class ReplicasVerify extends Handler { + @CommandLine.Mixin + private ScmOption scmOption; + + @CommandLine.Parameters(arity = "1", + description = Shell.OZONE_URI_DESCRIPTION) + private String uri; + + @CommandLine.Option(names = {"-o", "--output-dir"}, + description = "Destination where the directory where the generated output will be saved.", + defaultValue = "/opt/hadoop") + private String outputDir; + + @CommandLine.Option(names = "--checksums", + description = "Reads every replica for all the blocks associated with a given key.", + // value will be true only if the "--checksums" option was specified on the CLI + defaultValue = "false") + private boolean doExecuteChecksums; + + @CommandLine.Option(names = "--padding", + description = "List all keys with any missing padding, optionally limited to a volume/bucket/key URI.", + defaultValue = "false") + private boolean doExecutePadding; + + private Checksums checksums; + private FindMissingPadding findMissingPadding; + + @Override + protected void execute(OzoneClient client, OzoneAddress address) throws IOException { + LOG.info("Verifying replicas for {}", address); + checksums = new Checksums(client, outputDir, LOG, getConf()); + findMissingPadding = new FindMissingPadding(client, scmOption, LOG, out(), getConf()); + findCandidateKeys(client, address); + if (doExecuteChecksums) { + findMissingPadding.execute(); + } Review Comment: Correct, this because the processing happens in two parts. -- 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]
