Repository navigation
[fix][broker] Do not start classic geo-replicators on scalable-topic segment topics - #26691
Merged
merlimat merged 1 commit intoSep 25, 2026
Conversation
…segment topics A segment:// topic in a namespace with more than one replication cluster started a GeoPersistentReplicator toward the same-named segment on the remote cluster and opened a durable pulsar.repl.<remote> cursor. Segment DAGs are independent per cluster (PIP-460), so that target never exists: the replicator never connects and the cursor retains the segment's data. Skip the replicator in PersistentTopic.startReplicator() for segment topics, before the cursor is opened, and cover it with a two-cluster test.
void-ptr974
approved these changes
Sep 23, 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.
Motivation
A
segment://topic backing a scalable topic (PIP-460) lives in an ordinary namespace, so when that namespace has more than one replication cluster the topic's replication check treats it like any other persistent topic: on load it opens a durablepulsar.repl.<remote>cursor and starts aGeoPersistentReplicatortoward the same-namedsegment://topic on the remote cluster.That is never a valid target. Segment DAGs are independent per cluster (PIP-460, "Geo-Replication"), so the remote cluster either has no such segment or has one with a different hash range, owned by its own
ScalableTopicController. Geo-replication for scalable topics needs a mechanism of its own and is not designed yet.In practice the replicator never connects: its remote-topic pre-check asks the local admin for
/admin/v2/segment/.../partitions, which has no REST resource, so producer creation fails and is retried forever (before #26681 it looped without backoff). The replicator stays inStarting, and the never-advancing cursor retains the segment's data and counts toward the backlog quota.Modifications
PersistentTopic.startReplicator(): return early for segment topics, before the cursor is opened, with a debug log. This is the single method that creates both the cursor and the replicator, so the guard covers the initial check on load, policy updates and the unfence path alike. It is deliberately not an early return ininternalCheckReplication(), so thatremoveTopicIfLocalClusterNotAllowed()keeps running for segments as for any other topic.shadowTopicsonly comes from topic-level policies keyed by the segment's own name, which no admin path can set.ScalableTopicSegmentReplicationTest(two-clusterOneWayReplicatorTestBase): creates a scalable topic in a namespace replicated to two clusters, asserts that the namespace's replication clusters do resolve for each segment, and that aftercheckReplication()the segment has neither a replicator nor apulsar.repl.*cursor. Fails on the unpatched code withExpecting empty but was: ["r2"].Should land together with or after #26679: once no replicator is present on a segment, the
ReplicatedSubscriptionsControllerwould otherwise start writing snapshot markers into it, which that PR prevents.