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: efficient write blocking synchronization #354

Merged
merged 3 commits into from
Sep 13, 2022

Conversation

vlastahajek
Copy link
Contributor

Closes #352

Proposed Changes

More efficient synchronization around batching related code in WriteAPIBlocking

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • Tests pass
  • Commit messages are in semantic format

@vlastahajek vlastahajek changed the title Fix/write blocking mutex fix: efficient write blocking synchronization Sep 9, 2022
@vlastahajek vlastahajek marked this pull request as draft September 9, 2022 15:17
@vlastahajek vlastahajek marked this pull request as ready for review September 10, 2022 06:30
@vlastahajek vlastahajek added this to the v2.11.0 milestone Sep 10, 2022
api/writeAPIBlocking.go Outdated Show resolved Hide resolved
defer w.mu.Unlock()
if !w.batching {
w.batching = true
if atomic.LoadInt32(&w.batching) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't be easier to enforce or document that EnableBatching can be called before any write is performed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be easier to document it. I don't think it will be easier to enforce it. The way how it is safe.

api/writeAPIBlocking.go Outdated Show resolved Hide resolved
@vlastahajek vlastahajek merged commit 3552b24 into influxdata:master Sep 13, 2022
@vlastahajek vlastahajek deleted the fix/write-blocking-mutex branch September 13, 2022 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve throughput of blocking writes to the same bucket
2 participants