mychaow commented on a change in pull request #1721:
URL: https://github.com/apache/incubator-iotdb/pull/1721#discussion_r486742681



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
##########
@@ -1002,55 +1008,74 @@ private void findNodes(MNode node, PartialPath path, 
List<PartialPath> res, int
   }
 
   public void serializeTo(String snapshotPath) throws IOException {
-    try (BufferedWriter bw = new BufferedWriter(
-        new FileWriter(SystemFileFactory.INSTANCE.getFile(snapshotPath)))) {
-      root.serializeTo(bw);
+    MLogWriter mLogWriter = null;
+    try {
+      mLogWriter = new MLogWriter(snapshotPath);
+      root.serializeTo(mLogWriter);
+    } finally {
+      if (mLogWriter != null) {
+        mLogWriter.close();
+      }
     }
   }
 
   @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity 
warning
   public static MTree deserializeFrom(File mtreeSnapshot) {
-    try (BufferedReader br = new BufferedReader(new 
FileReader(mtreeSnapshot))) {
-      String s;
+    MLogReader mlogReader = null;
+    try {

Review comment:
       Got it!




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


Reply via email to