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

[Issue 1258][producer] Avoid a data race when flushing with load #1261

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

Gilthoniel
Copy link
Contributor

@Gilthoniel Gilthoniel commented Jul 26, 2024

Fixes #1258

Motivation

While flushing, the data channel is switched if a new allocated one which can cause the loss of messages because the length can be zero which would stop the procedure and at the same time a new message can be sent to the channel.

Modifications

Instead of allocating a new channel, it empties the existing one up to the length of the buffer of the channel before proceeding with the flush.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as TestFlushInProducer.

Documentation

  • Does this pull request introduce a new feature? no

@nodece nodece added this to the v0.14.0 milestone Jul 29, 2024
@RobertIndie RobertIndie merged commit 8dd4ed1 into apache:master Jul 30, 2024
7 checks passed
RobertIndie pushed a commit that referenced this pull request Jul 31, 2024
Fixes #1258

### Motivation

While flushing, the data channel is switched if a new allocated one which can cause the loss of messages because the length can be zero which would stop the procedure and at the same time a new message can be sent to the channel.

### Modifications

Instead of allocating a new channel, it empties the existing one up to the length of the buffer of the channel before proceeding with the flush.

(cherry picked from commit 8dd4ed1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible data race in internalFlush
3 participants