martinzink commented on a change in pull request #1188:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1188#discussion_r738041008



##########
File path: extensions/standard-processors/processors/TailFile.cpp
##########
@@ -797,11 +799,13 @@ void TailFile::updateFlowFileAttributes(const std::string 
&full_file_name, const
                                         const std::string &extension,
                                         std::shared_ptr<core::FlowFile> 
&flow_file) const {
   logger_->log_info("TailFile %s for %" PRIu64 " bytes", fileName, 
flow_file->getSize());
-  std::string logName = baseName + "." + std::to_string(state.position_) + "-" 
+
-                        std::to_string(state.position_ + flow_file->getSize() 
- 1) + "." + extension;
+  std::string logName = textfragmentutils::createFileName(baseName, extension, 
state.position_, flow_file->getSize());
   flow_file->setAttribute(core::SpecialFlowAttribute::PATH, state.path_);
   flow_file->addAttribute(core::SpecialFlowAttribute::ABSOLUTE_PATH, 
full_file_name);
   flow_file->setAttribute(core::SpecialFlowAttribute::FILENAME, logName);
+  flow_file->setAttribute(textfragmentutils::BASE_NAME_ATTRIBUTE, baseName);
+  flow_file->setAttribute(textfragmentutils::POST_NAME_ATTRIBUTE, extension);
+  flow_file->setAttribute(textfragmentutils::OFFSET_ATTRIBUTE, 
std::to_string(state.position_));

Review comment:
       No, it works without these. (e.g. DefragmentationTextTests dont use 
these attributes)
   
   If these are not set in the input files then these and the filename 
attribute wont be updated in the output file, but the defragmentation process 
will work.
   If these are set and they match in the incoming fragments then these and the 
filename attribute will be updated accordingly.
   On mixed inputs (not matching attributes in different inputs or not alligned 
offsets) it will fail.




-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to