GeezerVison is showing github.com — [fix][broker] Propagate migration policy read failures during topic loading by oneby-wang · Pull Request #27579 · apache/pulsar
Conversation
oneby-wang
commented
Nov 11, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Motivation
When the migration policy read failed during a persistent topic reload, checkTopicAlreadyMigrated ignored the exception and unboxed a null isMigrated. The resulting NullPointerException failed a discarded handle stage. The separate future returned by the migration check never completed, so getTopic reported a topic load timeout and hid the original metadata error.
Modifications
Return the thenCompose stage directly so a failed policy read reaches the caller with its original cause. A successful read still allows the load for an unmigrated topic and rejects a migrated topic with TopicMigratedException.
Verifying this change
-
Make sure that the change passes the CI checks.
-
testPersistentTopicReloadPropagatesMigrationPolicyFailure reproduced the broker timeout before the fix. With the fix, the same reload returns the exact MetadataStoreException injected by the test.
-
testPersistentTopicReloadHonorsClusterMigration verifies that the same topic reloads before migration and is rejected afterward under both load managers.
-
Local validation passed with retries disabled: all 70 BrokerServiceTest cases, both migration test instances, and quickCheck.
Does this pull request potentially affect one of the following parts:
- 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 — the existing topic load failure counter can now record a policy read failure under a non-timeout reason.
- Anything that affects deployment
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…oading
Assisted-by: OpenAI Codex (GPT-6)
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.
LGTM. Thanks for tracking down the hidden timeout and adding a test that reproduces it.
Returning the thenCompose stage directly fixes the root cause: the old handle ignored ex and NPE'd on the null isMigrated in a discarded stage. The failure now reaches the existing exceptionally in createPersistentTopic0, which unwraps it via failTopicFuture, and the TopicMigratedException path keeps the same wrapping. I also checked that testPersistentTopicReloadPropagatesMigrationPolicyFailure pins the fix: with the old handle code restored it fails with the topic load timeout, and with the fix it passes.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 21, 2026
Reviewers
lhotari
lhotari approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.