[client] Propagate write batch failures to flush#3468
Open
raoluSmile wants to merge 1 commit into
Open
Conversation
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.
Purpose
When
WriterClient.flush()waits for pending write batches, it relies onRecordAccumulator.awaitFlushCompletion(), which waits on eachWriteBatch.RequestFuture.Before this change, a write batch could be completed exceptionally through
WriteBatch.completeExceptionally(exception), butRequestFutureonly counteddown its latch and did not keep or rethrow the exception. As a result,
flush()could wait silently without surfacing the underlying write failure,and in retry/error paths this could look like a hang to the caller.
I hit this when TabletServer rejected writes with
DISK_WRITE_LOCKED.The writer kept retrying until request timeout, but the failure was not
propagated through the flush waiting path, so the test appeared to hang instead
of failing with the real write error.
This issue is independent of
DISK_WRITE_LOCKEDitself. Any write batch thatis completed exceptionally should be observable by callers waiting in
flush().This is related to, but different from, #1258. #1258 fixed a lost
WriteBatchcase where
awaitFlushCompletion()could wait forever. This PR fixes anotherfailure path: a
WriteBatchis completed exceptionally, but the correspondingRequestFuture.await()did not propagate the batch exception.Brief change log
WriteBatch.RequestFuturewhen a batch completes.RequestFuture.await().RecordAccumulator.awaitFlushCompletion()propagate batch failures.WriterClient.flush().awaitFlushCompletion()observes batch failures.Tests
./mvnw -pl fluss-client -DfailIfNoTests=false -Dtest=RecordAccumulatorTest#testAwaitFlushCompletionPropagatesBatchFailure test./mvnw -pl fluss-client -am -DskipTests compileAPI and Format
No public API or storage format changes.
Documentation
No documentation changes are required.