jaydyi commented on code in PR #367: URL: https://github.com/apache/flume/pull/367#discussion_r851573532
########## flume-ng-sources/flume-taildir-source/src/main/java/org/apache/flume/source/taildir/ReliableTaildirEventReader.java: ########## @@ -92,8 +92,11 @@ private ReliableTaildirEventReader(Map<String, String> filePaths, this.fileNameHeader = fileNameHeader; updateTailFiles(skipToEnd); - logger.info("Updating position from position file: " + positionFilePath); - loadPositionFile(positionFilePath); + File positionFile = new File(positionFilePath); + if (positionFile.exists() && positionFile.isFile() && positionFile.length() != 0) { + logger.info("Updating position from position file: " + positionFilePath); + loadPositionFile(positionFilePath); + } Review Comment: I also thought of this at first, but after i read position file operations related logic, i think it's redundant,the reasons are as follows. When TaildirSource start, operations related to position file include these: - ReliableTaildirEventReader initialization, `loadPositionFile(positionFilePath)` is executed here. - PositionWriterRunnable thread launched. ``` positionWriter = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("positionWriter").build()); positionWriter.scheduleWithFixedDelay(new PositionWriterRunnable(), writePosInitDelay, writePosInterval, TimeUnit.MILLISECONDS); ``` positionWriter's job is to read and write position file, and every time it is scheduled to execute, if the file does not exist, it will automatically generate an empty file. So to sum up, in the startup phase, it doesn't matter whether the file exists or not, so even an warning is not needed, because from the user's point of view, it is normal that the file does not exist when I start 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. To unsubscribe, e-mail: dev-unsubscr...@flume.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org