lordgamez commented on a change in pull request #1052:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1052#discussion_r618505287



##########
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:
       It seems that as I previously created a rolled over file for all tests 
which was later rewritten in the rollover scenario with the same filename and 
it was identified as a new file on Windows. Extracted the new test as a 
separate test case in cbd9e2175f650749134ff7cf66dcd672aa3eb03c where I removed 
this from the test setup.




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