prathmesh12-coder commented on code in PR #10604:
URL: https://github.com/apache/ozone/pull/10604#discussion_r3536372397
##########
hadoop-ozone/cli-debug/src/main/java/org/apache/hadoop/ozone/debug/replicas/ReplicasVerify.java:
##########
@@ -197,8 +212,68 @@ void findCandidateKeys(OzoneClient ozoneClient,
OzoneAddress address) throws IOE
checkVolume(ozoneClient, it.next(), keysArray, allKeysPassed);
}
}
- root.put("pass", allKeysPassed.get());
- System.out.println(JsonUtils.toJsonStringWithDefaultPrettyPrinter(root));
+ if (outputDir == null) {
+ root.put("pass", allKeysPassed.get());
+ System.out.println(JsonUtils.toJsonStringWithDefaultPrettyPrinter(root));
+ } else {
+ writeOutputToFiles(root, keysArray, allKeysPassed.get());
+ }
+ }
+
+ /**
+ * Writes verification output to file(s) instead of stdout.
+ * When recordsPerFile is greater than zero, the keys are split into
multiple valid JSON files.
+ */
+ private void writeOutputToFiles(ObjectNode root, ArrayNode keysArray,
boolean allKeysPassed) throws IOException {
Review Comment:
Thanks @sreejasahithi for review !
Added deletion of stale output files from prior runs before writing new
output files.
--
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]