errose28 commented on code in PR #8248:
URL: https://github.com/apache/ozone/pull/8248#discussion_r2053035316
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/replicas/ReplicasVerify.java:
##########
@@ -88,41 +109,122 @@ void findCandidateKeys(OzoneClient ozoneClient,
OzoneAddress address) throws IOE
String volumeName = address.getVolumeName();
String bucketName = address.getBucketName();
String keyName = address.getKeyName();
+
+ ObjectNode root = JsonUtils.createObjectNode(null);
+ ArrayNode keysArray = root.putArray("keys");
+
if (!keyName.isEmpty()) {
- OzoneKeyDetails keyDetails =
ozoneClient.getProxy().getKeyDetails(volumeName, bucketName, keyName);
- processKey(keyDetails);
+ OmKeyInfo keyInfo = ((RpcClient)
ozoneClient.getProxy()).getKeyInfo(volumeName, bucketName, keyName, false);
+ processKey(ozoneClient, keyInfo, keysArray);
} else if (!bucketName.isEmpty()) {
OzoneVolume volume = objectStore.getVolume(volumeName);
OzoneBucket bucket = volume.getBucket(bucketName);
- checkBucket(bucket);
+ checkBucket(ozoneClient, bucket, keysArray);
} else if (!volumeName.isEmpty()) {
OzoneVolume volume = objectStore.getVolume(volumeName);
- checkVolume(volume);
+ checkVolume(ozoneClient, volume, keysArray);
} else {
for (Iterator<? extends OzoneVolume> it = objectStore.listVolumes(null);
it.hasNext();) {
- checkVolume(it.next());
+ checkVolume(ozoneClient, it.next(), keysArray);
}
}
+
+ System.out.println(JsonUtils.toJsonStringWithDefaultPrettyPrinter(root));
}
- void checkVolume(OzoneVolume volume) throws IOException {
+ void checkVolume(OzoneClient ozoneClient, OzoneVolume volume, ArrayNode
keysArray) throws IOException {
for (Iterator<? extends OzoneBucket> it = volume.listBuckets(null);
it.hasNext();) {
OzoneBucket bucket = it.next();
- checkBucket(bucket);
+ checkBucket(ozoneClient, bucket, keysArray);
}
}
- void checkBucket(OzoneBucket bucket) throws IOException {
+ void checkBucket(OzoneClient ozoneClient, OzoneBucket bucket, ArrayNode
keysArray) throws IOException {
for (Iterator<? extends OzoneKey> it = bucket.listKeys(null);
it.hasNext();) {
OzoneKey key = it.next();
// TODO: Remove this check once HDDS-12094 is fixed
if (!key.getName().endsWith("/")) {
- processKey(bucket.getKey(key.getName()));
+ OmKeyInfo keyInfo = ((RpcClient) ozoneClient.getProxy()).getKeyInfo(
+ bucket.getVolumeName(), bucket.getName(), key.getName(), false);
+ processKey(ozoneClient, keyInfo, keysArray);
}
}
}
- void processKey(OzoneKeyDetails keyDetails) {
- replicaVerifiers.forEach(verifier -> verifier.verifyKey(keyDetails));
+ void processKey(OzoneClient ozoneClient, OmKeyInfo keyInfo, ArrayNode
keysArray) {
Review Comment:
`ozoneClient` parameter is unused, we can remove it. Alternatively we can
make this method take separate volume, bucket, key parameters and do the
`getKeyInfo` call here instead.
--
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]