in_tail: fix log duplication when a rotated file is appended during rotate_wait with follow_inodes - #5499
Draft
Watson1978 wants to merge 1 commit into
Draft
in_tail: fix log duplication when a rotated file is appended during rotate_wait with follow_inodes#5499Watson1978 wants to merge 1 commit into
Watson1978 wants to merge 1 commit into
Conversation
…otate_wait with follow_inodes With follow_inodes, a TailWatcher detached on rotation keeps reading its inode until rotate_wait elapses, but refresh_watchers only looked at @Tails and started a second TailWatcher for the same inode. Skip inodes still read by a watcher waiting for rotate_wait, and do not register a watcher in @tails_rotate_wait when open_on_every_update already detached it immediately. Fixes fluent#4243 Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue(s) this PR fixes:
Fixes #4243
What this PR does / why we need it:
With
follow_inodes true, a TailWatcher detached on rotation keeps reading its inode untilrotate_waitelapses, butrefresh_watchersonly looks at@tails, so it started a second TailWatcher for the same inode and lines appended to the rotated file in that window were collected twice. This PR makesrefresh_watchersskip inodes still read by a watcher waiting forrotate_wait, and the rotated file is followed again from the recorded position on the next refresh after that watcher is closed. This changes the timing of following a rotated file, so it targets the next minor release and should not be backported to v1.19.4.Docs Changes:
N/A
Release Note:
in_tail: fix log duplication when a rotated file is appended during
rotate_waitwithfollow_inodes