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

[docker log driver] Move pipeline check + creation to single atomic operation #14518

Merged

Conversation

fearful-symmetry
Copy link
Contributor

Thanks to @urso for reminding me about this. I noticed it a while ago, but somehow it never made it into #13990.

The operation for checking if a pipeline exists, creating a new pipeline, and registering a new pipeline was three separate operations. This allowed a new thread to potentially squeeze in a create an identical pipeline before another thread registered it.

I'm still worried about the performance implications of this, since we're throwing around a global lock quite a lot. However, the most common use case will be one config with one pipeline.

@fearful-symmetry fearful-symmetry added the Team:Integrations Label for the Integrations team label Nov 14, 2019
@fearful-symmetry fearful-symmetry requested review from urso and a team November 14, 2019 17:18
@fearful-symmetry fearful-symmetry self-assigned this Nov 14, 2019
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

File names should be lowercased.


var pipeline *Pipeline
var err error
pipeline, test := pm.pipelines[hashstring]
Copy link

Choose a reason for hiding this comment

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

When using a hash as key I'm always a little woried about false-positives due to hash collisions. Have you considered to compute a key value instead of using a hash value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this to #13990

@fearful-symmetry fearful-symmetry merged commit 6cf0f4a into elastic:feature/dockerbeat Nov 18, 2019
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…peration (elastic#14518)

* move pipeline check + creation to single atomic operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants