[fix][meta] Complete handleMetadataEvent future exceptionally when the initial get fails#26199
Open
SongOf wants to merge 1 commit into
Open
Conversation
…e initial get fails
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.
Motivation
AbstractMetadataStore#handleMetadataEventchains the initialget(event.getPath())withthenApply, but the outer chain has nohandler for exceptional completion. When that
getfails (e.g. thebacking store is unavailable), the
thenApplycallback is skipped andthe
resultfuture returned to the caller never completes.The caller is the
MetadataEventSynchronizerlistener path(
PulsarMetadataEventSynchronizer's consumer message listener): with ahanging future, neither the
acknowledgeAsyncstage nor theexceptionallystage ever runs, so the event message is notacknowledged, the failure cause is never logged, and every ack-timeout
redelivery registers another never-completing future. The inner
updateResultchain already handles exceptional completion; only theouter
getchain was missing it.Modifications
AbstractMetadataStore#handleMetadataEvent: switch the outer chainfrom
thenApply(whose mapped value was never used) tothenAccept,and append an
exceptionallystage that unwraps theCompletionExceptionviaFutureUtil.unwrapCompletionException,logs a warning, and completes the
resultfuture exceptionally withthe root cause.
exceptionallystage also covers exceptions thrownsynchronously inside the callback body (e.g. from
shouldIgnoreEvent), which previously left the future hanging thesame way.
inner
updateResulthandling (BadVersionExceptionis still treatedas success).
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
This is an internal behavior change: the future returned by
handleMetadataEventnow completes exceptionally instead of hangingwhen the initial read fails. No public API, schema, configuration,
wire protocol, REST endpoint, CLI option, or metric is affected.