[fix][test] Fix flaky ExtensibleLoadManagerImplTest by re-serving the channel topic in initializeState - #25976
Merged
lhotari merged 1 commit intoJun 8, 2026
Conversation
… channel topic in initializeState The initializeState @BeforeMethod could time out after 2 minutes when a prior test (e.g. testHandleNoChannelOwner) churned leader election and left the channel-topic bundle (pulsar/system, loadbalancer-service-unit-state) in an owner-recorded-but-unserved state. monitor() does not heal that state (handleNoChannelOwnerError only restarts election on the "no channel owner now" error), so the namespace unload could never publish to the channel. Force-serve the channel topic on every retry attempt via an admin lookup + getStats (the same sequence awaitChannelOwnerStable already uses), so the unload can proceed. Guarded to the system-topic table-view variant.
lhotari
approved these changes
Jun 8, 2026
11 tasks
Member
|
It seems that this didn't fully fix the problem since there was a failure: https://github.com/apache/pulsar/actions/runs/27153833000/job/80153890688?pr=25976#step:8:2151 |
Member
Merged
2 tasks
lhotari
pushed a commit
that referenced
this pull request
Jun 10, 2026
… channel topic in initializeState (#25976)
lhotari
pushed a commit
that referenced
this pull request
Jun 10, 2026
… channel topic in initializeState (#25976)
priyanshu-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jun 15, 2026
… channel topic in initializeState (apache#25976) (cherry picked from commit 136bc88)
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Aug 28, 2026
… channel topic in initializeState (apache#25976)
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
The
Pulsar CI Flakysuite has been failing frequently onExtensibleLoadManagerImplTest, with a 2-minute timeout in theinitializeState@BeforeMethod(example run: https://github.com/apache/pulsar/actions/runs/27144684649):Root cause. Tests such as
testHandleNoChannelOwnerdeliberately churn leader election by closing theLeaderElectionServiceon both brokers. This can leave the channel-topic bundlepulsar/system/0x00000000_0xffffffff(which hostsloadbalancer-service-unit-state) in an owner-recorded-but-not-actually-served state. Every channel operation then fails with... not served by this instance ... Please redo the lookup.initializeState(reworked in #25946) drivesmonitor()and retries the namespace unload for 120s, butmonitor()cannot heal this particular state:ExtensibleLoadManagerImpl.handleNoChannelOwnerErroronly restarts leader election when the channel reports "no channel owner now". When an owner is recorded but refuses to serve, no such error is thrown, recovery never triggers, and the unload — which must publish to the channel topic — can never succeed. The 120s budget is exhausted and the@BeforeMethodfails, cascading to skipped tests.Modifications
In
ExtensibleLoadManagerImplBaseTest.initializeState, force-serve the channel topic inside the existing retry loop, before the unload:admin.lookups().lookupTopic(...)re-assigns thepulsar/systembundle, andadmin.topics().getStats(...)forces the recorded owner to actually load it (the lookup layer alone can claim an owner that refuses to serve).This is the same sequence
awaitChannelOwnerStable()already uses to stabilize after churn, but run on every retry attempt so the channel is re-served immediately before each unload — rather than only once in the churn test'sfinally, where the state can degrade again before the nextinitializeState. It is guarded to theServiceUnitStateTableViewImpl(system-topic) variant, matchingawaitChannelOwnerStable's own guard; the metadata-store variant has no channel topic to serve.This is a test-side mitigation. The durable fix is product-side — teaching
monitor()/handleNoChannelOwnerErrorto detect owner-recorded-but-unserved and re-assign the bundle — and can follow separately.