Skip to content

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

Merged
fearful-symmetry merged 4 commits intoelastic:feature/dockerbeatfrom
fearful-symmetry:race-new-pipeline
Nov 18, 2019
Merged

[docker log driver] Move pipeline check + creation to single atomic operation#14518
fearful-symmetry merged 4 commits intoelastic:feature/dockerbeatfrom
fearful-symmetry:race-new-pipeline

Conversation

@fearful-symmetry
Copy link
Copy Markdown
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 a team and urso November 14, 2019 17:18
@fearful-symmetry fearful-symmetry self-assigned this Nov 14, 2019
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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