[improve][meta] PIP-453: Improve the metadata store threading model#25187
Merged
BewareMyPower merged 15 commits intoapache:masterfrom Feb 4, 2026
Merged
Conversation
1. Trigger callbacks in the underlying metadata store's internal thread directly. 2. Add a dedicated scheduler for batch flushing tasks 3. Add a dedicated thread pool for `MetadataCache`'s computing tasks 4. Add tests to verify serialization and deserialization tasks are executed in the pool whose thread count is specified by `metadataStoreSerDesThreads`
Contributor
Author
nodece
approved these changes
Jan 30, 2026
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
Outdated
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/cache/impl/MetadataCacheImpl.java
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements PIP-453 to improve the metadata store threading model by separating concerns across multiple dedicated thread pools. The change aims to prevent a single metadata store thread from being overwhelmed by various types of tasks (event handling, scheduling, flushing, and serialization/deserialization).
Changes:
- Replaced single
ScheduledExecutorServicewith four specialized executors:eventExecutorfor notifications,schedulerExecutorfor delayed tasks,flushExecutorfor batch flushing, andserDesExecutorfor serialization/deserialization - Modified callback execution to use the underlying store's thread directly instead of switching to executor thread
- Removed batch metadata store queue size metrics since the dedicated flush executor only handles flushing
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| AbstractMetadataStore.java | Introduces new thread pool structure with separate executors for events, scheduling, and ser/des operations |
| AbstractBatchedMetadataStore.java | Adds dedicated flush executor and updates flush mechanism with synchronized method |
| BatchMetadataStoreStats.java | Removes executor queue size metrics and simplifies constructor |
| MetadataCacheImpl.java | Updates to use OrderedExecutor for ser/des operations and separate scheduler for retries |
| ZKMetadataStore.java | Updates callback execution to use new helper methods |
| EtcdMetadataStore.java | Updates async operations to execute callbacks in event executor |
| RocksdbMetadataStore.java, LocalMemoryMetadataStore.java, OxiaMetadataStore.java | Updates constructors to pass numSerDesThreads parameter |
| ServiceConfiguration.java, MetadataStoreConfig.java | Adds new configuration for ser/des thread pool size |
| PulsarService.java | Propagates new configuration to metadata store instances |
| PulsarServiceTest.java | Adds comprehensive test for ser/des thread pool behavior |
| OpenTelemetryMetadataStoreStatsTest.java | Updates test to reflect removed metrics |
| MetadataStoreFactoryImplTest.java | Updates test constructor call |
| pip-453.md | Updates PIP document to reflect actual implementation with 4 thread sets |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java
Show resolved
Hide resolved
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
Outdated
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
Outdated
Show resolved
Hide resolved
...ata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java
Outdated
Show resolved
Hide resolved
...ata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java
Outdated
Show resolved
Hide resolved
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
Outdated
Show resolved
Hide resolved
dao-jun
reviewed
Feb 2, 2026
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
Outdated
Show resolved
Hide resolved
Contributor
Author
lhotari
approved these changes
Feb 4, 2026
Member
lhotari
left a comment
There was a problem hiding this comment.
LGTM, great work @BewareMyPower
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
Show resolved
Hide resolved
lhotari
approved these changes
Feb 4, 2026
Technoboy-
pushed a commit
to Technoboy-/pulsar
that referenced
this pull request
Feb 5, 2026
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.
PIP: #25173
Modifications
MetadataCache's computing tasksmetadataStoreSerDesThreadsDocumentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: