[improve][broker] Add topic-aware BookKeeper context for auxiliary ledger placement - #26702
Closed
void-ptr974 wants to merge 1 commit into
Closed
void-ptr974 wants to merge 1 commit into
void-ptr974 wants to merge 1 commit into
Conversation
Resolve topic placement configuration in one shared path and pair it with the cached BookKeeper client and matching ledger metadata. Assisted-by: Codex
This was referenced Sep 24, 2026
Contributor
Author
|
Closing in favor of #26705. The shared resolver and BookKeeper client-context commit remains the first of the three commits in that unified PR, whose description now documents the complete problem, implementation, and impact. |
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
Persistent topics resolve namespace
bookieAffinityGroupand strict bookie-affinity settings before selecting a BookKeeper client. Components that create auxiliary ledgers directly only have access to the default client, so they cannot safely reuse the same placement-specific client and persist the matching policy metadata.Using only the default client can make a configured namespace affinity ineffective. Adding only ledger metadata is also insufficient because a default Rackaware client does not execute
IsolatedBookieEnsemblePlacementPolicy.This is the shared prerequisite for applying topic placement to schema, delayed-delivery bucket, and compaction ledgers in follow-up stacked PRs.
Modifications
BrokerServicestrict/affinity/system-topic decision matrix intoBookKeeperPlacementPolicyConfigResolverand continue using it for managed ledgers.BookkeeperManagedLedgerStorageClass.ManagedLedgerClientFactoryserve that lookup from its existingEnsemblePlacementPolicyConfigclient cache.BookKeeperClientContext, which keeps the borrowed client and its encoded placement metadata together.PulsarService#getBookKeeperClientContext(TopicName)to resolve local namespace policies without loading the full topic policy stack.Behavior and impact
ManagedLedgerClientFactory.Dynamic policy changes are intentionally outside this stack.
Tests
./gradlew :pulsar-broker:test --tests org.apache.pulsar.broker.ManagedLedgerClientFactoryTest --tests org.apache.pulsar.broker.storage.BookKeeperPlacementPolicyConfigResolverTest --tests org.apache.pulsar.broker.storage.BookKeeperClientContextTest./gradlew :pulsar-broker:checkstyleMain :pulsar-broker:checkstyleTest./gradlew :pulsar-broker:clean :pulsar-broker:compileJava --no-build-cache --no-configuration-cacheAssisted-by: Codex