mychaow commented on a change in pull request #1721: URL: https://github.com/apache/incubator-iotdb/pull/1721#discussion_r489105676
########## File path: server/src/main/java/org/apache/iotdb/db/metadata/MManager.java ########## @@ -248,21 +237,27 @@ private int initFromLog(File logFile) throws IOException { // init the metadata from the operation log if (logFile.exists()) { int idx = 0; - try (FileReader fr = new FileReader(logFile); - BufferedReader br = new BufferedReader(fr)) { - String cmd; - while ((cmd = br.readLine()) != null) { + try (MLogReader mLogReader = new MLogReader(config.getSchemaDir(), MetadataConstant.METADATA_LOG);) { + + while (mLogReader.hasNext()) { + PhysicalPlan plan = null; try { - operation(cmd); + plan = mLogReader.next(); + if (plan == null) { + continue; + } + operation(plan); idx++; } catch (Exception e) { - logger.error("Can not operate cmd {}", cmd, e); + logger.error("Can not operate cmd {} for err:", plan.getOperatorType(), e); } } + logger.debug("spend {} ms to deserialize mtree from mlog.bin", + System.currentTimeMillis() - time); + return idx; + } catch (Exception e) { + throw new IOException("Failed to parser mlog.bin for err:" + e.toString()); Review comment: ok ---------------------------------------------------------------- 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