merlimat opened a new pull request, #25850: URL: https://github.com/apache/pulsar/pull/25850
## Summary Second implementation PR for [PIP-475: Regular-to-Scalable Topic Migration](https://github.com/apache/pulsar/blob/master/pip/pip-475.md). Builds on the broker-side synthetic-layout lookup (#25822) to let V5 clients operate against not-yet-migrated regular (partitioned or non-partitioned) topics through the scalable surface. A V5 producer or queue consumer pointed at `persistent://t/n/x` now talks to the same managed ledger a v4 client would — no migration required for V5 adoption. ### Builder validation - `V5Utils.parseScalableTopicInput` accepts `topic://`, `persistent://`, and short-form names (preserving the input domain so the broker resolves to either a real DAG or a synthetic layout), and rejects `non-persistent://` up front with `UnsupportedOperationException`. ### Per-segment dispatch - `SegmentRouter.ActiveSegment` carries an optional `legacyTopicName`. A *legacy segment* wraps an existing, externally-managed `persistent://` topic; `attachTopicName()` returns the right URI for the per-segment v4 producer/consumer (`persistent://...` for legacy, `segment://...` for regular controller-managed segments). - `ClientSegmentLayout.fromProto` populates `legacyTopicName` from `SegmentInfoProto.legacy_topic_name`. - All four V5 consumer/producer types attach per-segment v4 clients via `attachTopicName()`. ### Routing across synthetic layouts - `SegmentRouter.route()` detects the "all active leaves are legacy" case and switches to `signSafeMod(murmurHash3_32(key), N)` over `segment_id`, matching v4 partitioned-topic routing. Range-based routing still applies for any real DAG and for mixed layouts (sealed legacy parents + active children, post-migration). ### Resolved-identity plumbing - `DagWatchSession.onUpdate` now receives `(dag, resolvedTopicName)`. `ClientCnx` propagates `CommandScalableTopicUpdate.resolved_topic_name` to `DagWatchClient`, which uses it as the canonical parent topic for `segment://` URIs and exposes it via `topicName()`. ## Test plan - [x] `V5UtilsTest` — each input form + non-persistent rejection (5/5). - [x] `SegmentRouterTest` — mod-N for all-legacy, range-based for mixed/regular, determinism (13/13). - [x] `V5RegularTopicInteropTest` — end-to-end against a real broker: V5 producer → 4-partition regular topic with a v4 consumer per partition (verifies v4-compatible routing); V5 producer → non-partitioned regular topic with v4 consumer; v4 producer → V5 queue consumer; V5 builder rejects `non-persistent://` (4/4). -- 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]
