Skip to content

[feat] PIP-468: Add ScalableTopicController and broker infrastructure#25559

Open
merlimat wants to merge 3 commits intoapache:masterfrom
merlimat:st-broker-infra
Open

[feat] PIP-468: Add ScalableTopicController and broker infrastructure#25559
merlimat wants to merge 3 commits intoapache:masterfrom
merlimat:st-broker-infra

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

Summary

First PR in the PIP-468 series introducing scalable topics. This PR lands
the core broker-side infrastructure:

  • ScalableTopicController — per-topic coordinator with leader election,
    consumer session management, and layout tracking.
  • SegmentLayout — pure data/math for the hash-range segment DAG.
  • SubscriptionCoordinator — in-memory consumer-assignment tracking
    per subscription.
  • ScalableTopicService — per-broker service managing controller
    lifecycle (get/release controllers, lifecycle hooks on BrokerService).
  • Metadata-store resources: ScalableTopicResources,
    ScalableTopicMetadata, ConsumerRegistration, SubscriptionMetadata,
    SubscriptionType.
  • Unit tests for SegmentLayout and SubscriptionCoordinator.

Tests

Only the self-contained pure-data components have unit tests in this PR
(SegmentLayoutTest, SubscriptionCoordinatorTest).

End-to-end tests of ScalableTopicController and ScalableTopicService
are deferred to subsequent PRs because their setup depends on code that
lands later:

  • The tests mock PulsarAdmin.scalableTopics(), a type added by the
    admin-API PR.
  • splitSegment/mergeSegments live with the admin layer (they invoke
    admin.scalableTopics().createSegmentAsync / terminateSegmentAsync)
    and their tests move with them.

Test plan

  • :pulsar-broker:compileJava / :pulsar-broker:compileTestJava
    succeed on this commit in isolation.
  • ./gradlew :pulsar-broker:test --tests "org.apache.pulsar.broker.service.scalable.*"
    passes (SegmentLayoutTest, SubscriptionCoordinatorTest).

Implement the broker-side scalable topic engine: ScalableTopicController
handles per-topic leader election and consumer session management,
SegmentLayout manages the hash-range DAG, SubscriptionCoordinator tracks
consumer assignments across segments. Add ScalableTopicService for
per-topic controller lifecycle, ScalableTopicResources for metadata
persistence, and BrokerService integration. Includes unit tests for
SegmentLayout and SubscriptionCoordinator.

Split/merge operations, the admin REST layer, the client protocol
wiring, and the end-to-end controller/service tests follow in subsequent
PRs of the PIP-468 series.
@merlimat merlimat added type/feature The PR added a new feature or issue requested a new feature area/broker labels Apr 21, 2026
@merlimat merlimat changed the title PIP-468: Add ScalableTopicController and broker infrastructure [feat] PIP-468: Add ScalableTopicController and broker infrastructure Apr 21, 2026
- Remove unused imports from BrokerService, ScalableTopicController,
  and ScalableTopicService.
- Move io.github.merlimat.slog.Logger import to the correct position
  in SubscriptionCoordinator.
- Add package-info.java for the service.scalable package.
- Drop unused assertNull import and extra import-group blank lines in
  the test classes.
@merlimat merlimat requested a review from lhotari April 21, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/broker type/feature The PR added a new feature or issue requested a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant