Skip to content

[improve][meta] PIP-453: Improve the metadata store threading model#25187

Merged
BewareMyPower merged 15 commits intoapache:masterfrom
BewareMyPower:bewaremypower/impl-pip-453-meta-thread-model
Feb 4, 2026
Merged

[improve][meta] PIP-453: Improve the metadata store threading model#25187
BewareMyPower merged 15 commits intoapache:masterfrom
BewareMyPower:bewaremypower/impl-pip-453-meta-thread-model

Conversation

@BewareMyPower
Copy link
Contributor

PIP: #25173

Modifications

  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

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

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`
@BewareMyPower BewareMyPower self-assigned this Jan 27, 2026
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 27, 2026
@BewareMyPower BewareMyPower added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/metadata and removed doc-not-needed Your PR changes do not impact docs labels Jan 27, 2026
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 27, 2026
@BewareMyPower
Copy link
Contributor Author

@lhotari @tjiuming @nodece Could you take a look at this PR?

Copy link
Member

@nodece nodece left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM

@BewareMyPower BewareMyPower marked this pull request as draft February 1, 2026 13:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ScheduledExecutorService with four specialized executors: eventExecutor for notifications, schedulerExecutor for delayed tasks, flushExecutor for batch flushing, and serDesExecutor for 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.

@BewareMyPower BewareMyPower marked this pull request as draft February 2, 2026 05:26
@BewareMyPower BewareMyPower marked this pull request as ready for review February 2, 2026 05:56
@BewareMyPower BewareMyPower marked this pull request as draft February 2, 2026 06:41
@BewareMyPower BewareMyPower marked this pull request as ready for review February 3, 2026 03:45
@BewareMyPower BewareMyPower marked this pull request as draft February 3, 2026 08:14
@BewareMyPower BewareMyPower marked this pull request as ready for review February 3, 2026 12:13
@BewareMyPower
Copy link
Contributor Author

@nodece @lhotari @dao-jun Hi, the comments are all addressed and tests all passed eventually, PTAL again

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great work @BewareMyPower

@BewareMyPower BewareMyPower merged commit 6d415c6 into apache:master Feb 4, 2026
52 of 53 checks passed
@BewareMyPower BewareMyPower deleted the bewaremypower/impl-pip-453-meta-thread-model branch February 4, 2026 12:06
lhotari pushed a commit that referenced this pull request Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/metadata cherry-picked/branch-4.0 cherry-picked/branch-4.1 doc-not-needed Your PR changes do not impact docs PIP ready-to-test release/4.0.9 release/4.1.3 type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants