[feat] PIP-468: Add scalable topics and segments admin APIs with CLI#25565
Merged
merlimat merged 1 commit intoapache:masterfrom Apr 24, 2026
Merged
[feat] PIP-468: Add scalable topics and segments admin APIs with CLI#25565merlimat merged 1 commit intoapache:masterfrom
merlimat merged 1 commit intoapache:masterfrom
Conversation
3 tasks
lhotari
approved these changes
Apr 24, 2026
Member
lhotari
left a comment
There was a problem hiding this comment.
LGTM, I guess authnz will come later.
Add ScalableTopics REST resource for CRUD, split, and merge operations on scalable topics. Add Segments REST resource for cross-broker segment topic create/terminate/delete with ownership-based routing. Implement client-admin ScalableTopics interface and ScalableTopicsImpl with async support. Add CmdScalableTopics CLI commands (list, create, get-metadata, delete, split-segment, merge-segments). Wire into PulsarAdmin and PulsarAdminTool.
11 tasks
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
May 6, 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.
Summary
Third PR in the PIP-468 series. Wires up the admin/management surface
for scalable topics:
REST APIs (broker)
ScalableTopicsREST resource — create / list / get-metadata / get-stats /delete / create-subscription / delete-subscription / split / merge.
Includes
redirectToControllerLeaderIfNeededfor write operations sonon-leader brokers automatically 307 to the leader.
SegmentsREST resource — cross-broker segment-topiccreate / terminate / delete with ownership-based routing.
Client-admin API
ScalableTopicsinterface onPulsarAdminwith sync and asynccounterparts for every operation.
ScalableTopicsImpl— REST client wiring.org.apache.pulsar.common.policies.data:ScalableTopicMetadata(plus nestedSegmentInfoandHashRange),ScalableTopicStats(plus nestedSegmentStatsandSubscriptionStatsrecords),
ScalableSubscriptionTypeenum.CLI
CmdScalableTopicspulsar-adminsubcommand withlist,create,get-metadata,stats,delete,split-segment,merge-segments.Broker integration
ScalableTopicControllergainscreateSubscription,deleteSubscription, andgetStats— exposing admin-visibleoperations on top of the infrastructure added in [feat] PIP-468: Add ScalableTopicController and broker infrastructure #25559.
ScalableTopicServicegains matching per-topic delegations +admin-layer entry points (
createScalableTopic,deleteScalableTopic,splitSegment,mergeSegments, etc.) used by the REST handlers.DagWatchSessionto pick up the reviewed changes from[feat] PIP-468: Add scalable topic protocol commands and connection handling #25564.
Tests
New test classes (24 tests)
ScalableTopicStatsTest(10 tests) — construction (no-args /@Builder/ all-args),@Builder.Defaultfresh-per-instancebehavior, equals/hashCode, and the nested
SegmentStats/SubscriptionStatsrecords.ScalableTopicMetadataTest(11 tests) — same construction patterns,plus
SegmentInfo.isActive/isSealed(including the unknown-statebranch), full getters on a sealed segment, and
HashRange.toString()format (lowercase 4-digit hex).
ScalableSubscriptionTypeTest(3 tests) — locks down the enum valuesso a rename breaks the build;
valueOfroundtrip and rejection ofunknown names.
Expanded in this commit
ScalableTopicControllerTest— 24 tests covering all controllermethods including
createSubscription/deleteSubscription/getStats/ stats-after-split-and-subscriptions / etc.ScalableTopicServiceTest— 16 tests covering service lifecycle,create/delete topic, get-or-create-controller (caching + failure +
eviction), release, delegation to split / merge / subscriptions /
stats / register / disconnect, and topic cleanup.
Coverage on this branch
CommandsScalableTopicTest(from #25564)ConsumerSessionTest(from #25564)DagWatchSessionTest(from #25564)ScalableTopicControllerTestScalableTopicServiceTestSegmentLayoutTest(from #25559)SubscriptionCoordinatorTest(from #25559)ScalableTopicStatsTestScalableTopicMetadataTestScalableSubscriptionTypeTestTest plan
./gradlew :pulsar-client-admin-api:test --tests "org.apache.pulsar.common.policies.data.Scalable*Test"— 24/24 pass../gradlew :pulsar-broker:test --tests "org.apache.pulsar.broker.service.scalable.*"— 93/93 pass../gradlew :pulsar-common:test --tests "org.apache.pulsar.common.protocol.CommandsScalableTopicTest"— 8/8 pass../gradlew :pulsar-client-admin-api:checkstyleMain :pulsar-client-admin-api:checkstyleTest :pulsar-broker:checkstyleMain :pulsar-broker:checkstyleTest :pulsar-common:checkstyleMain :pulsar-common:checkstyleTest :pulsar-client-admin-original:checkstyleMain :pulsar-client-tools:checkstyleMain— clean.