zhaizhibo opened a new pull request, #24639: URL: https://github.com/apache/pulsar/pull/24639
### Motivation ``` 2025-08-17T18:30:56,880+0800 [metadata-store-10-1] INFO org.apache.pulsar.broker.resources.MetadataStoreCacheLoader.lambda$init$0(MetadataStoreCacheLoader.java:68) - Successfully updated broker info [xx.xxx.238.222:24010, xx.xxx.238.226:24010, xx.xxx.64.175:24010, xx.xxx.86.50:24010, xx.xxx.38.249:24010, xx.xxx.168.210:24010] 2025-08-17T18:30:56,880+0800 [metadata-store-10-1] INFO org.apache.pulsar.broker.resources.MetadataStoreCacheLoader.lambda$init$0(MetadataStoreCacheLoader.java:68) - Successfully updated broker info [xx.xxx.238.222:24010, xx.xxx.238.226:24010, xx.xxx.86.50:24010, xx.xxx.38.249:24010, xx.xxx.168.210:24010] ``` The second update (with 5 brokers) was actually processed before the first update (with 6 brokers), but due to concurrent operations, the incorrect result was cached. When updating the availableBrokers in MetadataStoreCacheLoader, there is a possibility that the actual processing order of ZooKeeper updates may become inconsistent. This could occur due to: 1. Uncertain callback execution order after `loadReportResources.getChildrenAsync(LOADBALANCE_BROKERS_ROOT)` 2. Uncertain execution sequence in the common-forkjoin thread pool `via .thenApplyAsync` ### Modifications 1. ensure sequential processing – Only one update operation proceeds at a time, with subsequent updates waiting until the current completes 2. Added scheduled update for availableBrokers list. ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc` <!-- Your PR contains doc changes. --> - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later --> - [x] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `doc-complete` <!-- Docs have been already added --> ### Matching PR in forked repository PR in forked repository: <!-- ENTER URL HERE --> <!-- After opening this PR, the build in apache/pulsar will fail and instructions will be provided for opening a PR in the PR author's forked repository. apache/pulsar pull requests should be first tested in your own fork since the apache/pulsar CI based on GitHub Actions has constrained resources and quota. GitHub Actions provides separate quota for pull requests that are executed in a forked repository. The tests will be run in the forked repository until all PR review comments have been handled, the tests pass and the PR is approved by a reviewer. --> -- 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]
