[FLINK-40660][connector-base] Retry the shutdown synchronization put in SplitFetcher - #29182
Open
MartijnVisser wants to merge 1 commit into
Open
MartijnVisser wants to merge 1 commit into
MartijnVisser wants to merge 1 commit into
Conversation
…in SplitFetcher Retry the put that hands over the empty synchronization batch, because put() returns false without enqueueing when the queue is full and the fetcher has an unconsumed wakeUp flag, which drops the batch and leaves the fetcher blocked on recordsProcessedLatch with its SplitReader never closed. Generated-by: Claude Code (Claude Opus 5)
Collaborator
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.
What is the purpose of the change
SplitFetcher#runhands over an empty synchronization batch after its loop ends, so theSplitReaderis only closed once the records it emitted have been processed. It discards the return value of thatput.FutureCompletingBlockingQueue#putreturns false without enqueueing when the queue is full and the fetcher has an unconsumed wakeUp flag, so the batch is dropped andrecycle()never runs.The fetcher then blocks on
recordsProcessedLatchforever, itsSplitReaderis never closed andfetchersToShutDownis never decremented.maybeShutdownFinishedFetchershas already removed it from the fetcher map, soSplitFetcherManager#closecannot release it either and blocks until its timeout. The retry terminates because a refused put consumes the flag, andrunningTaskis already null at that point so nothing can set it again.Brief change log
SplitFetcher#runinstead of discarding its resultVerifying this change
This change added tests and can be verified as follows:
SplitFetcherTest#testShutdownSynchronizationBatchIsRetriedAfterWakeUpfills a capacity-1 queue from another producer, leaves an unconsumed wakeUp for the fetcher's own index and shuts the fetcher down. It times out on the parent commit with "The fetcher should have enqueued its shutdown synchronization batch" and passes with this change.release-1.20is not affected, since it has norecordsProcessedLatchand no synchronization batch. The patched block is byte-identical onrelease-2.0throughrelease-2.3.Does this pull request potentially affect one of the following parts:
@Public(Evolving): yes,SplitFetcheris@PublicEvolving, but no signature changes and the behaviour change is confined to its shutdown pathDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Opus 5)