[docker log driver] Move pipeline check + creation to single atomic operation#14518
Merged
fearful-symmetry merged 4 commits intoelastic:feature/dockerbeatfrom Nov 18, 2019
Merged
Conversation
26 tasks
exekias
reviewed
Nov 14, 2019
jsoriano
reviewed
Nov 14, 2019
Member
jsoriano
left a comment
There was a problem hiding this comment.
File names should be lowercased.
urso
reviewed
Nov 16, 2019
urso
reviewed
Nov 16, 2019
urso
reviewed
Nov 16, 2019
|
|
||
| var pipeline *Pipeline | ||
| var err error | ||
| pipeline, test := pm.pipelines[hashstring] |
There was a problem hiding this comment.
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?
urso
approved these changes
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.