ChenSammi commented on code in PR #9479:
URL: https://github.com/apache/ozone/pull/9479#discussion_r2650408424
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/ContainerUtils.java:
##########
@@ -166,25 +169,71 @@ public static synchronized void writeDatanodeDetailsTo(
* @return {@link DatanodeDetails}
* @throws IOException If the id file is malformed or other I/O exceptions
*/
- public static synchronized DatanodeDetails readDatanodeDetailsFrom(File path)
- throws IOException {
+ public static synchronized DatanodeDetails readDatanodeDetailsFrom(
+ File path, ConfigurationSource conf) throws IOException {
if (!path.exists()) {
throw new IOException("Datanode ID file not found.");
}
try {
return DatanodeIdYaml.readDatanodeIdFile(path);
} catch (IOException e) {
- LOG.warn("Error loading DatanodeDetails yaml from {}",
- path.getAbsolutePath(), e);
- // Try to load as protobuf before giving up
- try (InputStream in = Files.newInputStream(path.toPath())) {
- return DatanodeDetails.getFromProtoBuf(
- HddsProtos.DatanodeDetailsProto.parseFrom(in));
- } catch (IOException io) {
- throw new IOException("Failed to parse DatanodeDetails from "
- + path.getAbsolutePath(), io);
+ LOG.warn("Failed to read Datanode ID file as YAML. Reason: {}. " +
Review Comment:
Please use "e" instead of e.getMessage() here. Stack trace will reveal more
info than e.getMessage() during debug. e.getMessage() is usually used when
constructing error message propagated from client to server.
--
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]