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

pkg/cacheutil: Async op fix #8044

Merged
merged 4 commits into from
Jan 10, 2025
Merged

pkg/cacheutil: Async op fix #8044

merged 4 commits into from
Jan 10, 2025

Conversation

dsabsay
Copy link
Contributor

@dsabsay dsabsay commented Jan 7, 2025

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

This fixes the test in #8043. That separate PR was only to show that the test fails in CI.

The existing implementation sometimes drops existing operations that are
still on the queue when .stop() is called.

If multiple communications in a select statement can proceed, one is
chosen pseudo-randomly: https://go.dev/ref/spec#Select_statements

This means that sometimes a processor worker will process a remaining
operation, and sometimes it won't.

Verification

I ran the test multiple times locally, switching between the old implementation of asyncQueueProcessLoop() and this new one.

Additionally, #8043 shows that the new test fails in CI with the old implementation.

Daniel Sabsay added 2 commits January 6, 2025 16:25
The existing implementation sometimes drops existing operations that are
still on the queue when .stop() is called.

If multiple communications in a select statement can proceed, one is
chosen pseudo-randomly: https://go.dev/ref/spec#Select_statements

This means that sometimes a processor worker will process a remaining
operation, and sometimes it won't.

Signed-off-by: Daniel Sabsay <[email protected]>
@dsabsay
Copy link
Contributor Author

dsabsay commented Jan 7, 2025

For context, the result of this bug is flaky tests: cortexproject/cortex#6480

GiedriusS
GiedriusS previously approved these changes Jan 7, 2025
@@ -0,0 +1,33 @@
package cacheutil
Copy link
Member

Choose a reason for hiding this comment

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

You are missing a header here, please add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@dsabsay
Copy link
Contributor Author

dsabsay commented Jan 9, 2025

@GiedriusS I think this is ready now. Please take a look when you have a chance.

@dsabsay dsabsay requested a review from GiedriusS January 9, 2025 18:23
@GiedriusS GiedriusS merged commit 4ba0ba4 into thanos-io:main Jan 10, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants