merlimat opened a new pull request, #25565:
URL: https://github.com/apache/pulsar/pull/25565

   > **Stacked on top of #25564** (which is stacked on #25559). Opened as a
   > draft; will be rebased on master once the upstream PRs land. Reviewers:
   > the new code in this PR is the single commit titled "PIP-468: Add
   > scalable topics and segments admin APIs with CLI" — everything else
   > comes from #25559 and #25564.
   
   ## Summary
   
   Third PR in the PIP-468 series. Wires up the admin/management surface
   for scalable topics:
   
   ### REST APIs (broker)
   
   - `ScalableTopics` REST resource — create / list / get-metadata / get-stats /
     delete / create-subscription / delete-subscription / split / merge.
     Includes `redirectToControllerLeaderIfNeeded` for write operations so
     non-leader brokers automatically 307 to the leader.
   - `Segments` REST resource — cross-broker segment-topic
     create / terminate / delete with ownership-based routing.
   
   ### Client-admin API
   
   - `ScalableTopics` interface on `PulsarAdmin` with sync and async
     counterparts for every operation.
   - `ScalableTopicsImpl` — REST client wiring.
   - Data types under `org.apache.pulsar.common.policies.data`:
     `ScalableTopicMetadata` (plus nested `SegmentInfo` and `HashRange`),
     `ScalableTopicStats` (plus nested `SegmentStats` and `SubscriptionStats`
     records), `ScalableSubscriptionType` enum.
   
   ### CLI
   
   - `CmdScalableTopics` `pulsar-admin` subcommand with `list`, `create`,
     `get-metadata`, `stats`, `delete`, `split-segment`, `merge-segments`.
   
   ### Broker integration
   
   - `ScalableTopicController` gains `createSubscription`,
     `deleteSubscription`, and `getStats` — exposing admin-visible
     operations on top of the infrastructure added in #25559.
   - `ScalableTopicService` gains matching per-topic delegations +
     admin-layer entry points (`createScalableTopic`, `deleteScalableTopic`,
     `splitSegment`, `mergeSegments`, etc.) used by the REST handlers.
   - Small tweak to `DagWatchSession` to pick up the reviewed changes from
     #25564.
   
   ## Tests
   
   ### New test classes (24 tests)
   
   - `ScalableTopicStatsTest` (10 tests) — construction (no-args /
     `@Builder` / all-args), `@Builder.Default` fresh-per-instance
     behavior, equals/hashCode, and the nested `SegmentStats` /
     `SubscriptionStats` records.
   - `ScalableTopicMetadataTest` (11 tests) — same construction patterns,
     plus `SegmentInfo.isActive` / `isSealed` (including the unknown-state
     branch), full getters on a sealed segment, and `HashRange.toString()`
     format (lowercase 4-digit hex).
   - `ScalableSubscriptionTypeTest` (3 tests) — locks down the enum values
     so a rename breaks the build; `valueOf` roundtrip and rejection of
     unknown names.
   
   ### Expanded in this commit
   
   - `ScalableTopicControllerTest` — 24 tests covering all controller
     methods 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
   
   | Test class | Tests |
   |---|---|
   | `CommandsScalableTopicTest` (from #25564) | 8 |
   | `ConsumerSessionTest` (from #25564) | 15 |
   | `DagWatchSessionTest` (from #25564) | 12 |
   | `ScalableTopicControllerTest` | 24 |
   | `ScalableTopicServiceTest` | 16 |
   | `SegmentLayoutTest` (from #25559) | 15 |
   | `SubscriptionCoordinatorTest` (from #25559) | 11 |
   | `ScalableTopicStatsTest` | 10 |
   | `ScalableTopicMetadataTest` | 11 |
   | `ScalableSubscriptionTypeTest` | 3 |
   | **Total** | **125** |
   
   ## Test plan
   
   - [x] `./gradlew :pulsar-client-admin-api:test --tests 
"org.apache.pulsar.common.policies.data.Scalable*Test"` — 24/24 pass.
   - [x] `./gradlew :pulsar-broker:test --tests 
"org.apache.pulsar.broker.service.scalable.*"` — 93/93 pass.
   - [x] `./gradlew :pulsar-common:test --tests 
"org.apache.pulsar.common.protocol.CommandsScalableTopicTest"` — 8/8 pass.
   - [x] `./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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to