fix(storage): preserve flush state across concurrent flushes in async writers#16274
Open
kalragauri wants to merge 1 commit into
Open
fix(storage): preserve flush state across concurrent flushes in async writers#16274kalragauri wants to merge 1 commit into
kalragauri wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the SetFlushed method in both AsyncWriterConnectionBufferedState and AsyncWriterConnectionResumedState to only reset the flush_ flag to false when there are no remaining pending flush promises. The unit tests have been updated to align with this change, expecting a second flush and query sequence. I have no feedback to provide as there are no review comments.
kalragauri
force-pushed
the
feat/flush-fix
branch
from
July 24, 2026 09:56
58f5b7f to
1586e25
Compare
kalragauri
marked this pull request as ready for review
July 24, 2026 09:57
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16274 +/- ##
=======================================
Coverage 92.29% 92.29%
=======================================
Files 2221 2221
Lines 207372 207384 +12
=======================================
+ Hits 191386 191399 +13
+ Misses 15986 15985 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In
SetFlushed(), bothAsyncWriterConnectionBufferedStateandAsyncWriterConnectionResumedStatewere unconditionally resetting the internal state flagflush_ = falseat the very start of the method when a flush succeeded. If a caller issued multiple concurrentFlush()requests (or queued a new Flush() while a previous Flush() was in-flight), resettingflush_ = falseprematurely caused the backgroundWriteLoopto treat any remaining queued data as buffered data rather than explicit flush requests.This PR modifies
SetFlushed()to defer resettingflush_ = falseuntilpending_flush_promises_.empty()evaluates to true (or when handling empty promise edge cases). This guarantees that as long as there are pending flush promises in the queue,flush_remains true, instructing theWriteLoopto continue invoking flush operations on subsequent chunks until all queued flush promises are satisfied.