Skip to content

fix(disk-buffer): Remove empty buffer on close #17247

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

Merged
merged 3 commits into from
Jun 27, 2025

Conversation

srebhan
Copy link
Member

@srebhan srebhan commented Jun 26, 2025

Summary

When fully emptying a disk-buffer and then restarting (i.e. shutdown and start) Telegraf then empty disk-buffer still contains a (masked) metric due to restrictions in the upstream library. At runtime this is not an issue because we keep track of the empty state of the buffer and do not send the metric again. However, when shutting down Telegraf the WAL file still contains the (masked) metric but the mask and the "empty buffer" flag gets lost as it is not persisted to disk. As a consequence, we will resend the last metric even though it already has been sent.

This PR deletes the WAL file(s) when closing the empty buffer to make sure we do not send the metric again. This code can likely go away again if either tidwall/wal#31 or tidwall/wal#29 are merged.

Checklist

  • No AI generated code was used in this PR

Related issues

related to #16981

@srebhan srebhan changed the title Disk buffer issue 16981 fix(disk-buffer): Remove empty buffer on close Jun 26, 2025
@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Jun 26, 2025
@srebhan srebhan added area/agent plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins and removed fix pr to fix corresponding bug labels Jun 26, 2025
Copy link
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

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

@srebhan This is a solid improvement over the previous version. Added a few comments in the code.

@srebhan srebhan requested a review from skartikey June 27, 2025 08:35
@telegraf-tiger
Copy link
Contributor

@skartikey skartikey assigned mstrandboge and unassigned skartikey Jun 27, 2025
@skartikey skartikey added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jun 27, 2025
@mstrandboge mstrandboge merged commit 533e0a9 into influxdata:master Jun 27, 2025
26 of 27 checks passed
@github-actions github-actions bot added this to the v1.36.0 milestone Jun 27, 2025
@srebhan srebhan added the fix pr to fix corresponding bug label Jul 7, 2025
@srebhan srebhan modified the milestones: v1.36.0, v1.35.2 Jul 7, 2025
srebhan added a commit that referenced this pull request Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/agent fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants