-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][fn] complete flushAsync before closeAsync in ProducerCache and wait for completion in closing the cache#25140
[fix][fn] complete flushAsync before closeAsync in ProducerCache and wait for completion in closing the cache#25140Technoboy- merged 2 commits intoapache:masterfrom
Conversation
Fixes issue discussed on Slack
Motivation
While trying to implement a very similar component, I was poking around the ProducerCache and noticed that closeAsync was invoked without waiting for flushAsync to complete. I believe this could lead to correctness issues.
Modifications
I've simplified the code to directly call flushAsync, rather than start a future that calls it.
Verifying this change
- Make sure that the change passes the CI checks.
This change attempted to add tests, but they currently fail because the existing test harness makes false assumptions / the code it's testing doesn't actually work (specifically, ProducerCache.close doesn't actually wait for cache removal listener futures).
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
- Dependencies (add or upgrade a dependency)
- The public API
- The schema
- The default values of configurations
- The threading model
- The binary protocol
- The REST endpoints
- The admin CLI options
- The metrics
- Anything that affects deployment
Documentation
-
doc -
doc-required -
doc-not-needed -
doc-complete
Matching PR in forked repository
PR in forked repository: dontgitit#1
lhotari
left a comment
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.
Thanks for the good work @dontgitit. I added a commit to fix the test to implement the graceful closing of the cache based one of the workarounds mentioned in the issue that you pointed out in the slack discussion.
flushAsync completes before calling closeAsync in ProducerCache
Codecov Report Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #25140 +/- ## ============================================= + Coverage 30.69% 74.50% +43.80% - Complexity 51 33698 +33647 ============================================= Files 1840 1899 +59 Lines 145551 149745 +4194 Branches 16924 17411 +487 ============================================= + Hits 44679 111569 +66890 + Misses 93910 29300 -64610 - Partials 6962 8876 +1914
Flags with carried forward coverage won't be shown. Click here to find out more.
New features to boost your workflow:
|
Co-authored-by: Lari Hotari
(cherry picked from commit 21819c6)
(cherry picked from commit c22f3d5)
Co-authored-by: Lari Hotari
(cherry picked from commit 21819c6)
(cherry picked from commit 00def71)
Co-authored-by: Lari Hotari
(cherry picked from commit 21819c6)
(cherry picked from commit c22f3d5)
Co-authored-by: Lari Hotari
(cherry picked from commit 21819c6)
(cherry picked from commit 00def71)
Co-authored-by: Lari Hotari
(cherry picked from commit 21819c6)
(cherry picked from commit c22f3d5)
Co-authored-by: Lari Hotari
(cherry picked from commit 21819c6)
(cherry picked from commit c22f3d5)
Co-authored-by: Lari Hotari
(cherry picked from commit 21819c6)
(cherry picked from commit c22f3d5)
Co-authored-by: Lari Hotari
(cherry picked from commit 21819c6)
(cherry picked from commit c22f3d5)