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

fix(agent): Use a unique WAL file for plugin instances of the same type #15966

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

DStrand1
Copy link
Member

@DStrand1 DStrand1 commented Oct 2, 2024

Summary

Includes the alias (if set) in the file path for the WAL file to avoid plugins named the same sharing a WAL file and causing race conditions

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #15876

@DStrand1 DStrand1 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 Oct 2, 2024
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Oct 2, 2024

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Oct 2, 2024
@DStrand1
Copy link
Member Author

DStrand1 commented Oct 2, 2024

!signed-cla

@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Oct 2, 2024

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

@DStrand1 I don't think this will fix the issue as you now require the user to set an alias! It would be better to use the plugin ID instead as it is actually unique per plugin...

@DStrand1 DStrand1 assigned DStrand1 and unassigned srebhan Oct 2, 2024
@DStrand1 DStrand1 removed 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 Oct 2, 2024
@DStrand1 DStrand1 assigned srebhan and unassigned DStrand1 Oct 8, 2024
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @DStrand1 for the update. Please find my comments in the code...

models/buffer.go Outdated
@@ -49,7 +49,7 @@ type BufferStats struct {
}

// NewBuffer returns a new empty Buffer with the given capacity.
func NewBuffer(name string, alias string, capacity int, strategy string, path string) (Buffer, error) {
func NewBuffer(id, name, alias string, capacity int, strategy, path string) (Buffer, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Do you need the alias still? Maybe name, id would be more intuitive?

Copy link
Member Author

Choose a reason for hiding this comment

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

The alias is still used for the buffer stats for both buffer strategies, though it isn't used for either buffer configuration otherwise. I can swap ID and name here though

models/buffer_disk.go Outdated Show resolved Hide resolved
models/buffer_disk.go Outdated Show resolved Hide resolved
models/buffer_disk_test.go Outdated Show resolved Hide resolved
models/buffer_mem_test.go Outdated Show resolved Hide resolved
models/buffer_suite_test.go Outdated Show resolved Hide resolved
models/running_output.go Outdated Show resolved Hide resolved
models/buffer.go Outdated Show resolved Hide resolved
@srebhan srebhan changed the title fix(agent.buffer): Fix shared wal file between same named plugins fix(agent): Use a unique WAL file for plugin instances of the same type Oct 9, 2024
@srebhan srebhan added area/agent plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Oct 9, 2024
@DStrand1 DStrand1 requested a review from srebhan October 9, 2024 23:57
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks @DStrand1! Do you feel like we can merge this or do you want to run this past the issue reporter again?

@DStrand1
Copy link
Member Author

Thanks @DStrand1! Do you feel like we can merge this or do you want to run this past the issue reporter again?

@srebhan I think this is ready to merge, though let me address the test failure first

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Telegraf crashes when buffer_strategy = "disk" and more than one output plugin of the same type is configured
2 participants