in_tail: fix typo of @follow_inodes in detach_watcher - #5514
Merged
Merged
Conversation
**Which issue(s) this PR fixes**: Fixes # **What this PR does / why we need it**: TailInput#detach_watcher checked `@follow_inode`, which is not defined anywhere, instead of `@follow_inodes`. The typo was introduced in 52e46f0 ("in_tail: Fix a stall bug on !follow_inode case", #4327). With `follow_inodes true`, position entries are keyed by inode, and the inode of a rotated file is dropped from `@tails` when its TailWatcher is detached by `update_watcher`. So `detach_watcher` must unwatch the position entry of that inode even if the same path is still followed by a new watcher. With the typo, the condition was always `nil || !@Tails[tw.path]`, so the entry was left in the position file. Note that `tw.unwatched` is currently set to true only when `follow_inodes` is false (since 51848da), so this doesn't change the behavior of the existing code paths. It makes the condition work as intended so that the position entry handling stays correct when the `unwatched` flag is used with `follow_inodes` too. Add tests for `detach_watcher`: - with `follow_inodes true`, the position entry of the rotated inode is unwatched even while the path is still followed by another watcher. - with `follow_inodes false`, the position entry of the path is kept while the path is still followed by a watcher. **Docs Changes**: None **Release Note**: None Assisted-by: LLM Qwen3.8-Flash-Next Signed-off-by: Takuro Ashie <ashie@clear-code.com>
Member
Author
|
I don't think it's needed to port to v1.19 since it's a dead condition in the current code. |
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 #
What this PR does / why we need it:
TailInput#detach_watcher checked
@follow_inode, which is not defined anywhere, instead of@follow_inodes. The typo was introduced in 52e46f0 ("in_tail: Fix a stall bug on !follow_inode case", #4327).With
follow_inodes true, position entries are keyed by inode, and the inode of a rotated file is dropped from@tailswhen its TailWatcher is detached byupdate_watcher. Sodetach_watchermust unwatch the position entry of that inode even if the same path is still followed by a new watcher. With the typo, the condition was alwaysnil || !@tails[tw.path], so the entry was left in the position file.Note that
tw.unwatchedis currently set to true only whenfollow_inodesis false (since 51848da), so this doesn't change the behavior of the existing code paths. It makes the condition work as intended so that the position entry handling stays correct when theunwatchedflag is used withfollow_inodestoo.Add tests for
detach_watcher:follow_inodes true, the position entry of the rotated inode is unwatched even while the path is still followed by another watcher.follow_inodes false, the position entry of the path is kept while the path is still followed by a watcher.Docs Changes:
None
Release Note:
None
Assisted-by: LLM Qwen3.8-Flash-Next