xiaoyuyao commented on a change in pull request #822: HDDS-1527. HDDS Datanode 
start fails due to datanode.id file read error
URL: https://github.com/apache/hadoop/pull/822#discussion_r284531715
 
 

 ##########
 File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/helpers/ContainerUtils.java
 ##########
 @@ -221,8 +226,16 @@ public synchronized static DatanodeDetails 
readDatanodeDetailsFrom(File path)
     try {
       return DatanodeIdYaml.readDatanodeIdFile(path);
     } catch (IOException e) {
-      throw new IOException("Failed to parse DatanodeDetails from "
-          + path.getAbsolutePath(), e);
+      LOG.warn("Error loading DatanodeDetails yaml from " +
+          path.getAbsolutePath(), e);
+      // Try to load as protobuf before giving up
+      try (FileInputStream in = new FileInputStream(path)) {
 
 Review comment:
   @swagle , change looks good to me. Can you add a unit test to valid the 
upgrade case where the old protobuf is successfully read and rewrite into yaml 
format. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to