Repository navigation
[fix][broker] Avoid blocking the bundle-throughput lookup on per-bundle metadata reads - #26054
Merged
lhotari merged 1 commit intoJun 18, 2026
Conversation
…le metadata reads ModularLoadManagerImpl.getBundleDataOrDefault(String) reads bundle data (with a resource-quota fallback) from the metadata store, blocking on two .join() calls behind a plain BundleData return. NamespaceBundleFactory .getBundleWithHighestThroughputAsync() called it once per bundle inside a getBundlesAsync(...).thenApply(...) continuation, so the continuation thread (which completes getBundlesAsync, a metadata-cache callback) blocked on a metadata read for every bundle in the namespace. - Add ModularLoadManager.getBundleDataOrDefaultAsync(String), composing the two metadata reads asynchronously and returning the default BundleData on miss/error (preserving the exact logic). To stay backward compatible for custom ModularLoadManager implementations it is a default method delegating to the existing sync method; ModularLoadManagerImpl overrides it with the real async implementation. - Deprecate the blocking getBundleDataOrDefault(String); it now delegates to getBundleDataOrDefaultAsync(...).join(). All internal callers (the load-data update loop, preallocateBundle, selectBroker) and the tests use the async variant. - NamespaceBundleFactory.getBundleWithHighestThroughputAsync() composes getBundleDataOrDefaultAsync() for all bundles (thenCompose + waitForAll) and selects the max-throughput bundle off the already-complete futures, with no blocking on the continuation thread.
lhotari
approved these changes
Jun 18, 2026
sandeep-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Jul 31, 2026
…le metadata reads (apache#26054) (cherry picked from commit 561f373)
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Aug 28, 2026
…le metadata reads (apache#26054) (cherry picked from commit 561f373)
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
ModularLoadManagerImpl.getBundleDataOrDefault(String)reads bundle data (with a resource-quota fallback) from the metadata store, blocking on two.join()calls behind a plainBundleDatareturn. Its clean signature hid that it blocks.NamespaceBundleFactory.getBundleWithHighestThroughputAsync()called it once per bundle inside agetBundlesAsync(...).thenApply(...)continuation — so the continuation thread (which completesgetBundlesAsync, a metadata-cache callback) blocked on a metadata read for every bundle in the namespace. This is reachable from the admin path (NamespacesBase.findHotBundleAsync).Modifications
ModularLoadManager.getBundleDataOrDefaultAsync(String), composing the two metadata reads asynchronously and returning the defaultBundleDataon miss/error (preserving the exact logic of the blocking method). To stay backward compatible for customModularLoadManagerimplementations, it is adefaultmethod delegating to the existing sync method;ModularLoadManagerImploverrides it with the real async implementation.getBundleDataOrDefault(String); it now delegates togetBundleDataOrDefaultAsync(...).join(). All internal callers (the load-data update loop,preallocateBundle,selectBroker) and the tests now use the async variant, so the deprecated method has no remaining callers except the interface's compat bridge.NamespaceBundleFactory.getBundleWithHighestThroughputAsync()now composesgetBundleDataOrDefaultAsync()for all bundles (thenCompose+waitForAll) and selects the max-throughput bundle off the already-complete futures — no blocking on the continuation thread.Verifying this change
This change is covered by existing tests, which pass:
ModularLoadManagerImplTest.testBundleDataDefaultValueandNamespaceServiceTest.testSplitBundleWithHighestThroughput.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes