-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Remove unneeded locks in add_kubernetes_metadata #16979
Merged
jsoriano
merged 2 commits into
elastic:master
from
jsoriano:add-kubernetes-metadata-locks
Mar 12, 2020
Merged
Remove unneeded locks in add_kubernetes_metadata #16979
jsoriano
merged 2 commits into
elastic:master
from
jsoriano:add-kubernetes-metadata-locks
Mar 12, 2020
Conversation
This file contains 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
Read/write mutexes in matchers and indexers are only locked for read, making them unnecesary. These locks are acquired for any event that is enriched by the processor, so unneeded locking may affect performance. Also, refactor locking in indexing registry so it is used in all cases.
jsoriano
added
review
refactoring
[zube]: In Review
Team:Platforms
Label for the Integrations - Platforms team
labels
Mar 12, 2020
Pinging @elastic/integrations-platforms (Team:Platforms) |
blakerouse
reviewed
Mar 12, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but probably better to get another reviewer for +1.
exekias
approved these changes
Mar 12, 2020
jsoriano
added a commit
to jsoriano/beats
that referenced
this pull request
Mar 12, 2020
Read/write mutexes in matchers and indexers are only locked for read, making them unnecesary. These locks are acquired for any event that is enriched by the processor, so unneeded locking may affect performance. Also, refactor locking in indexing registry so it is used in all cases. (cherry picked from commit 2a643c9)
5 tasks
jsoriano
added a commit
that referenced
this pull request
Mar 24, 2020
Read/write mutexes in matchers and indexers are only locked for read, making them unnecesary. These locks are acquired for any event that is enriched by the processor, so unneeded locking may affect performance. Also, refactor locking in indexing registry so it is used in all cases. (cherry picked from commit 2a643c9)
This was referenced May 28, 2020
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
What does this PR do?
Read/write mutexes in matchers and indexers are only locked for read,
making them unnecesary. We could consider to add write locks, but writes
only happen on constructions, so it wouldn't be expected to read from these
structs before they are returned by the constructor.
These locks are acquired for any event that is enriched by the processor, so
unneeded locking may affect performance.
Also, refactor locking in indexing registry so it is used in all operations. It is
currently used only in some operations, and in external calls the lock needs to
be acquired in some cases.
This lock could be also removed because we only write to this structure
on
init()
s, but we use to make our registries thread-safe, so let's keep itas is. It is only used when seting up the processor, and not when processing
events, so it shouldn't affect performance.
Why is it important?
Unneeded locking can be confusing and may affect performance.
Inconsistent locking may lead to unexpected results in future changes.
Checklist
I have commented my code, particularly in hard-to-understand areasI have made corresponding changes to the documentationI have made corresponding change to the default configuration files