fgerlits commented on a change in pull request #1052: URL: https://github.com/apache/nifi-minifi-cpp/pull/1052#discussion_r618353909
########## File path: extensions/standard-processors/processors/TailFile.cpp ########## @@ -653,29 +690,56 @@ void TailFile::onTrigger(const std::shared_ptr<core::ProcessContext> &, const st if (!session->existsFlowFileInRelationship(Success)) { yield(); } + + first_trigger_ = false; +} + +bool TailFile::isOldFileInitiallyRead(TailState &state) const { + // This is our initial processing and no stored state was found + return first_trigger_ && state.checksum_ == 0; } void TailFile::processFile(const std::shared_ptr<core::ProcessSession> &session, const std::string &full_file_name, TailState &state) { - uint64_t fsize = utils::file::FileUtils::file_size(full_file_name); - if (fsize < state.position_) { - processRotatedFiles(session, state); - } else if (fsize == state.position_) { - logger_->log_trace("Skipping file %s as its size hasn't change since last read", state.file_name_); - return; + if (isOldFileInitiallyRead(state)) { + if (initial_start_position_ == "Beginning of Time") { + processAllRotatedFiles(session, state); + } else if (initial_start_position_ == "Current Time") { + state.position_ = utils::file::FileUtils::file_size(full_file_name); + state.last_read_time_ = std::chrono::system_clock::now(); Review comment: I would use `utils::file::FileUtils::computeChecksum()` as it is done in `findRotatedFiles()` (line 656), mainly for consistency, but it's also slightly shorter/simpler. -- 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