Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject chunks without timekey from candidates of destination of symlink #1234

Merged
merged 2 commits into from
Sep 20, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Reject chunks without timekey from candidates of destination of symlink
"symlink" feature is to link from symlink_path to the latest file chunk. Records with latest timekey will be appended into that file chunk.
On the other side, resumed file chunks might NOT have timekey, especially in the cases that resumed file chunks are generated by
Fluentd v0.12. These chunks will be enqueued immediately, and will be flushed soon.

So these files SHOULD NOT be a candidate of destination of symlink.
  • Loading branch information
tagomoris committed Sep 13, 2016
commit 9247240d72c18326584c4763d0d92ae200652a86
2 changes: 1 addition & 1 deletion lib/fluent/plugin/out_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def symlink_path=(path)

def generate_chunk(metadata)
chunk = super
latest_chunk = metadata_list.sort_by(&:timekey).last
latest_chunk = metadata_list.select{|m| m.timekey }.sort_by(&:timekey).last
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment is better for understanding why we pick up only chunks which have timekey data.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment.

if chunk.metadata == latest_chunk
FileUtils.ln_sf(chunk.path, @_symlink_path)
end
Expand Down