mychaow commented on a change in pull request #1721: URL: https://github.com/apache/incubator-iotdb/pull/1721#discussion_r486736939
########## File path: server/src/main/java/org/apache/iotdb/db/writelog/io/LogWriter.java ########## @@ -41,13 +42,26 @@ private IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig(); private ByteBuffer lengthBuffer = ByteBuffer.allocate(4); private ByteBuffer checkSumBuffer = ByteBuffer.allocate(8); + private long forcePeriodInMs = 0; - public LogWriter(String logFilePath) { + public LogWriter(String logFilePath, long forcePeriodInMs) throws FileNotFoundException { logFile = SystemFileFactory.INSTANCE.getFile(logFilePath); + this.forcePeriodInMs = forcePeriodInMs; + + if (channel == null) { + fileOutputStream = new FileOutputStream(logFile, true); + channel = fileOutputStream.getChannel(); + } } - public LogWriter(File logFile) { + public LogWriter(File logFile, long forcePeriodInMs) throws FileNotFoundException { this.logFile = logFile; + this.forcePeriodInMs = forcePeriodInMs; + + if (channel == null) { + fileOutputStream = new FileOutputStream(logFile, true); Review comment: I think we should throw the exception for it's not normal, because fileoutputstream could create it if not exist. ---------------------------------------------------------------- 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