merlimat opened a new pull request, #25427:
URL: https://github.com/apache/pulsar/pull/25427

   ## Motivation
   Fix flaky test `testLoadBalancerServiceUnitTableViewSyncer` in 
`ExtensibleLoadManagerImplTest`.
   
   ### 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 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
   - Set registry state to `Closed` BEFORE deleting the ZK node to prevent the 
notification handler's session-expiry recovery from auto-re-registering the 
broker
   - Call `cleanOwnerships()` before unregistration (matching the 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
   - 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` 
finally block
   - Make `maxParallelForks` configurable via Gradle property
   
   ## Documentation
   - [x] `doc-not-needed`
   
   ## Matching PR in forked repository
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to