ChenSammi commented on code in PR #8707:
URL: https://github.com/apache/ozone/pull/8707#discussion_r2212671647


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerDataYaml.java:
##########
@@ -88,10 +96,11 @@ public static void createContainerFile(ContainerData 
containerData, File contain
   public static ContainerData readContainerFile(File containerFile)
       throws IOException {
     Preconditions.checkNotNull(containerFile, "containerFile cannot be null");
-    try (InputStream inputFileStream = 
Files.newInputStream(containerFile.toPath())) {
-      return readContainer(inputFileStream);
-    }
-
+    String originalContent = FileUtils.readFileToString(containerFile, 
StandardCharsets.UTF_8);
+    ContainerData containerData =
+        readContainer(originalContent.getBytes(StandardCharsets.UTF_8));
+    containerData.setYamlData(originalContent);

Review Comment:
   We can not keep yaml String in memory if feature is disabled if we pass the 
containerData to dump function, so yaml String can be created before dump, and 
we don't need to update in memory yaml String every time container meta change. 



-- 
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]

Reply via email to