The current topic creation behavior when enabling Geo-Replication Users using Geo-Replication backup data across multiple clusters, as well as Admin APIs related to Geo-Replication and internal replicators of brokers, will trigger topics of auto-creation between clusters.
pulsar-admin topics create-partitioned-topic
. It does not depend on enabling allowAutoTopicCreation
.allowAutoTopicCreation
.pulsar-admin topics update-partitioned-topic -p {partitions}
, the broker will also update partitions on the remote cluster automatically.allowAutoTopicCreation
. In fact, this behavior is not related to Geo-Replication, it is the behavior of the internal producer of Geo-Replicator,In the following scenarios, automatic topic creation across clusters is problematic due to race conditions during deployments, and there is no choice that prevents pulsar resource creation affects each other between clusters.
GitOps CD
automated deployment, for whichPassed solution: disable allowAutoTopicCreation
, the APIs pulsar-admin topics create-partitioned-topic
still create topics on the remote cluster when enabled namespace level replication, the API enable topic-level replication
still create topics, And the internal replicator will keep printing error logs due to a not found error.
pulsar-admin topics create-partitioned-topic
and pulsar-admin topics set-replication-clusters
to the component Replicator in the broker internal.pulsar-admin topics update-partitioned-topic -p {partitions}
, the broker will also update partitions on the remote cluster automatically.Note: the proposal will only focus on phase one, and the detailed design for phase two with come up with another proposal.
broker.conf
# Whether the internal replication of the local cluster will trigger topic auto-creation on the remote cluster. # 1. After enabling namespace-level Geo-Replication: whether the local broker will create topics on the remote cluster automatically when calling `pulsar-admin topics create-partitioned-topic`. # 2. When enabling topic-level Geo-Replication on a partitioned topic: whether the local broker will create topics on the remote cluster. # 3. Whether the internal Geo-Replicator in the local cluster will trigger non-persistent topic auto-creation for remote clusters. # It is not a dynamic config, the default value is "true" to preserve backward-compatible behavior. createTopicToRemoteClusterForReplication=true
createTopicToRemoteClusterForReplication
is set to false
.pulsar-admin topics create-partitioned-topic
.enableReplicatedSubscriptions
, the subscription will also be created on the remote cluster after users enable. enableReplicatedSubscriptions
.allowAutoTopicCreation
still works for the local cluster as before, it will not be affected by the new config createTopicToRemoteClusterForReplication
.createTopicToRemoteClusterForReplication
is set to true
. a. All components work as before, see details: Motivation -> The current topic creation behavior when enabling Geo-Replication
createTopicToRemoteClusterForReplication
is set to false
.createTopicToRemoteClusterForReplication
is set to true
.partitions of local cluster | partitions of remote cluster | After PIP-370 Phase 2 | Before PIP-370 Phase 2 |
---|---|---|---|
2 | no topic exists | create a partitioned topic with 2 partitions in the remote cluster | the replicator will only trigger partition creation ({topic}-partition-0 and {topic}-partition-1 ), and will not care about partitioned metadata. |
2 | 1 | In dispute: The replicator copies messages from partition-0 to the remote cluster, does not copy any data for partition-1 and just prints error logs in the background. | the replicator will only trigger partition creation ({topic}-partition-0 and {topic}-partition-1 ), and the partitioned metadata in the remote cluster is still 1 |
2 | 2 | modifies nothing. | The same as “After PIP-370 Phase 2 ” |
2 | >2 | In dispute: modifies nothing, the messages will be copied to the same partition in the remote cluster, and no message will be copied to the partition who is larger than 2 in the remote cluster | The same as “After PIP-370 Phase 2 ” |
2 | 0 (non-partitioned topic) | In dispute: The replicator does not copy any data and just prints error logs in the background. | the replicator will only trigger partition creation ({topic}-partition-0 and {topic}-partition-1 ), then users will get 3 non-partitioned topics: [{tp}, {topic}-partition-0, {topic}-partition-1 . |
0 (non-partitioned topic) | 0 (non-partitioned topic) | Copy data normally | It is the same as before PIP-370 . |
0 (non-partitioned topic) | no topic exists | create a non-partitioned topic in the remote cluster. | It is the same as before PIP-370 . |
0 (non-partitioned topic) | >=1 | In dispute: The replicator does not copy any data and just prints error logs in the background. | The replicator will only trigger a non-partitioned topic's creation, then users will get 1 non-partitioned topic and 1 partitioned topic. |
Name | Description | Attributes | Units |
---|---|---|---|
pulsar_replication_disconnected_count | Counter. The number of replicators. | cluster, namespace, topic | - |
pulsar_broker_replication_disconnected_count
keeps larger than 0
for a period of time, it means some replicators do not work, we should push an alert out.This PIP guarantees full compatibility with default settings(the default value of createTopicToRemoteClusterForReplication
is true
). If you want to cherry-pick PIP-370 for another branch in the future, you need to cherry-pick PIP-344 as well. Because the behavior of disables createTopicToRemoteClusterForReplication
depends on the API PulsarClient.getPartitionsForTopic(String topic, boolean metadataAutoCreationEnabled)
, which was introduced by PIP-344.
The two scenarios are as follows, the replication will not work as before, which will lead backlog increase, please take care of checking your clusters before upgrading.
local_cluster.topic.partitions = 2
and remote_cluster.topic.partitions = 0(non-partitioned topic)
: see detail in the section Design & Implementation Details -> Phase-2
.local_cluster.topic.partitions = 0(non-partitioned topic)
and and remote_cluster.topic.partitions >= 1
: see detail in the section Design & Implementation Details -> Phase-2
.