GeezerVison is showing github.com — [fix][broker] Don't swap the local metadata store's synchronizer when configurationMetadataSyncEventTopic is updated on a shared store by poorbarcode · Pull Request #22695 · apache/pulsar
Conversation
poorbarcode
commented
May 10, 2024
•
edited by merlimat
Loading
Uh oh!
There was an error while loading. Please reload this page.
Originally by @poorbarcode, now narrowed to a guard.
Motivation
When configurationMetadataStoreUrl is the same as metadataStoreUrl (the default when it is unset), PulsarService uses one store instance for both. Setting configurationMetadataSyncEventTopic dynamically then runs initConfigMetadataSynchronizerIfNeeded(), which only checks instanceof MetadataStoreExtended before it calls:
MetadataStoreExtended metadataStoreExtended = (MetadataStoreExtended) configurationMetadataStore;
metadataStoreExtended.updateMetadataEventSynchronizer(newSynchronizer);
Because that instance is also the local store, every local put or delete now calls synchronizer.notify() first (AbstractMetadataStore). The call fails with producer is not started yet until the producer starts. Loading the sync topic needs managed-ledger metadata writes on that same store, so the producer never starts. After that, every local metadata write fails (ownership, topic creation, ledger rollover). deleteDynamicConfiguration can't undo the setting either, because it is a write to the same store.
Example on one broker with a shared store:
pulsar-admin brokers update-dynamic-config --config configurationMetadataSyncEventTopic \
--value persistent://pulsar/system/__sync_config_meta
pulsar-admin namespaces create public/ns1 # fails: producer is not started yet
Modifications
PulsarService#isConfigurationMetadataStoreSharedWithLocal() returns whether the two stores are the same instance.
initConfigMetadataSynchronizerIfNeeded() logs a warning and does nothing when the stores are shared. This matches startup, which already ignores the configuration sync topic in that case.
BrokersBase#persistDynamicConfigurationAsync rejects configurationMetadataSyncEventTopic with 412 when the stores are shared. Delete is still allowed, so a value persisted earlier can be cleared.
Compared with the earlier version of this PR, this adds no new configuration, keeps one store instance, and leaves the existing tests unchanged.
Verifying this change
SyncConfigStoreSharedWithLocalTest starts two brokers whose configuration store URL equals the local URL. It checks that:
- the admin update returns 412 and nothing is persisted;
- applying the setting directly does not create a synchronizer, and namespace and topic creation still succeed afterwards.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@poorbarcode Please add the following content to your PR description and select a checkbox:
- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
poorbarcode reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…s causing all operations stuck
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
… configurationMetadataSyncEventTopic is updated on a shared store
When the configuration metadata store URL equals the local one, both use
the same store instance. A dynamic update of
configurationMetadataSyncEventTopic replaced that instance's synchronizer,
so every local metadata write waited on a producer that could never start.
Skip the swap in initConfigMetadataSynchronizerIfNeeded() and reject the
admin update with 412 in that case.
Adopts the fix proposed in apache#22695.
Replaces the earlier approach (forceUseSeparatedConfigurationStoreInMemory)
with a guard: skip the synchronizer swap and reject the dynamic update of
configurationMetadataSyncEventTopic with 412 when the configuration
metadata store is the same instance as the local one.
|
@poorbarcode thanks for finding this. It still reproduces on master: when the local and configuration stores are the same instance, a dynamic configurationMetadataSyncEventTopic replaces the local store's synchronizer in initConfigMetadataSynchronizerIfNeeded(), and every local metadata write then fails with "producer is not started yet".
As part of the open-PR backlog cleanup, I've taken this over and narrowed it to a guard. In that case the broker now skips the swap and the admin update returns 412. There's no new config flag and no second store instance. I merged it on top of your branch (no force push), so your commits are still in the history, and I updated the title and description to match. SyncConfigStoreSharedWithLocalTest covers it. Reviews welcome.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|