[fix][test] Fix flaky testLoadBalancerServiceUnitTableViewSyncer - #25427
Merged
merlimat merged 2 commits intoMar 31, 2026
Merged
Conversation
merlimat
force-pushed
the
fix/flaky-testLoadBalancerServiceUnitTableViewSyncer
branch
2 times, most recently
from
March 28, 2026 18:03
876d2df to
316ac80
Compare
Root cause: The test calls brokerRegistry.unregister() to simulate a broker going offline, but in the test environment all brokers share the same MetadataStore. The ZK node deletion triggers an asynchronous notification that BrokerRegistryImpl.handleMetadataStoreNotification() interprets as a session-expiry, causing it to auto-re-register the broker. This race makes the broker appear to never go offline. Fix: - Set registry state to Closed BEFORE deleting the ZK node to prevent the notification handler from auto-re-registering - Call cleanOwnerships() before unregistration (matching production disableBroker() flow) - Delete the ZK node directly via metadata store instead of using unregister() which has a CAS check - Add Awaitility waits with ignoreExceptions() for SLA ownership reassignment (async metadata cache invalidation) - Increase syncer activation/deactivation timeouts from 10s to 30s - Restore original lookup services in initializeState() to prevent state leakage between tests - Add null check for lookup in testUnloadClientReconnectionWithLookup - Make maxParallelForks configurable in build.gradle.kts
merlimat
force-pushed
the
fix/flaky-testLoadBalancerServiceUnitTableViewSyncer
branch
from
March 29, 2026 03:29
316ac80 to
b181daf
Compare
lhotari
approved these changes
Mar 31, 2026
merlimat
deleted the
fix/flaky-testLoadBalancerServiceUnitTableViewSyncer
branch
March 31, 2026 01:07
lhotari
pushed a commit
that referenced
this pull request
Apr 21, 2026
) (cherry picked from commit 0c285f4)
lhotari
pushed a commit
that referenced
this pull request
Apr 21, 2026
) (cherry picked from commit 0c285f4)
lhotari
pushed a commit
that referenced
this pull request
Apr 21, 2026
) (cherry picked from commit 0c285f4)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Apr 23, 2026
…che#25427) (cherry picked from commit 0c285f4) (cherry picked from commit eca80ff)
2 tasks
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
May 27, 2026
…che#25427) (cherry picked from commit 0c285f4)
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
Fix flaky test
testLoadBalancerServiceUnitTableViewSyncerinExtensibleLoadManagerImplTest.Root Cause
The test calls
brokerRegistry.unregister()to simulate a broker going offline, but in the test environment all brokers share the sameMetadataStore. The ZK node deletion triggers an asynchronous notification thatBrokerRegistryImpl.handleMetadataStoreNotification()interprets as a session-expiry event, causing it to auto-re-register the broker. This race makes the broker appear to never go offline.Additionally, SLA namespace ownership is determined lazily via metadata cache lookups. After broker unregistration, the cached broker data must be invalidated before ownership can be reassigned. The test was making immediate assertions without waiting for this async propagation.
Modifications
ClosedBEFORE deleting the ZK node to prevent the notification handler's session-expiry recovery from auto-re-registering the brokercleanOwnerships()before unregistration (matching the productiondisableBroker()flow)unregister()which has a CAS check.ignoreExceptions()for SLA ownership reassignmentinitializeState()to prevent state leakage between testslookupintestUnloadClientReconnectionWithLookupfinally blockmaxParallelForksconfigurable via Gradle propertyDocumentation
doc-not-neededMatching PR in forked repository
No response