adoroszlai commented on code in PR #7748: URL: https://github.com/apache/ozone/pull/7748#discussion_r1933496472
########## hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java: ########## @@ -57,11 +64,12 @@ * given key. It also generates a manifest file with information about the * downloaded replicas. */ [email protected](name = "read-replicas", [email protected](name = "checksums", description = "Reads every replica for all the blocks associated with a " + - "given key.") + "given key.", + aliases = {"read-replicas"}) @MetaInfServices(DebugSubcommand.class) -public class ReadReplicas extends KeyHandler implements DebugSubcommand { +public class ReadReplicas extends Handler implements DebugSubcommand { Review Comment: Implementing `DebugSubcommand` adds this one directly under `ozone debug`, so it should be removed if we want to move, not copy. ```suggestion public class ReadReplicas extends Handler { ``` Note that acceptance tests exercise this tool, they will need to be updated: ``` hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug.robot hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-tests.robot hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-stale-datanode.robot hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-corrupt-block.robot hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-dead-datanode.robot ``` ########## hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java: ########## @@ -246,4 +204,91 @@ private File createDirectory(String volumeName, String bucketName, } return dir; } + + private void findCandidateKeys(OzoneClient ozoneClient, OzoneAddress address) throws IOException { + ObjectStore objectStore = ozoneClient.getObjectStore(); + String volumeName = address.getVolumeName(); + String bucketName = address.getBucketName(); + String keyName = address.getKeyName(); + if (!keyName.isEmpty()) { + processKey(ozoneClient, volumeName, bucketName, keyName); + } else if (!bucketName.isEmpty()) { + OzoneVolume volume = objectStore.getVolume(volumeName); + OzoneBucket bucket = volume.getBucket(bucketName); + checkBucket(bucket, ozoneClient); + } else if (!volumeName.isEmpty()) { + OzoneVolume volume = objectStore.getVolume(volumeName); + checkVolume(volume, ozoneClient); + } else { + for (Iterator<? extends OzoneVolume> it = objectStore.listVolumes(null); it.hasNext();) { + checkVolume(it.next(), ozoneClient); + } + } + } Review Comment: Please avoid duplicating code from `FindMissingPadding`. -- 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]
