Skip to content

Backport(v1.19): in_tail: fix typo of @follow_inodes in detach_watcher (#5514) - #5533

Merged
Watson1978 merged 1 commit into
v1.19from
backport-to-v1.19/pr5514
Oct 11, 2026
Merged

Watson1978 merged 1 commit into
v1.19from
backport-to-v1.19/pr5514

Conversation

@github-actions

Copy link
Copy Markdown

Which issue(s) this PR fixes:
Backport #5514
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

**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>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@Watson1978 Watson1978 added this to the v1.19.5 milestone Oct 11, 2026
@Watson1978
Watson1978 merged commit 4237251 into v1.19 Oct 11, 2026
20 of 21 checks passed
@Watson1978
Watson1978 deleted the backport-to-v1.19/pr5514 branch October 11, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants