poorbarcode commented on code in PR #23124:
URL: https://github.com/apache/pulsar/pull/23124#discussion_r1714591000


##########
pip/pip-370.md:
##########
@@ -0,0 +1,58 @@
+# PIP-370: configurable remote topic creation in geo-replication
+
+# Background knowledge
+
+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.
+- For partitioned topics.
+  - After enabling namespace-level Geo-Replication: the broker will create 
topics on the remote cluster automatically when calling `pulsar-admin topics 
create-partitioned-topic`. It does not depend on enabling 
`allowAutoTopicCreation`.
+  - When enabling topic-level Geo-Replication on a partitioned topic: the 
broker will create topics on the remote cluster automatically. It does not 
depend on enabling `allowAutoTopicCreation`.
+- For non-partitioned topics and partitions of partitioned topics.
+  - The internal Geo-Replicator will trigger topics auto-creation for remote 
clusters. **(Highlight)** It depends on enabling `allowAutoTopicCreation`. In 
fact, this behavior is not related to Geo-Replication, it is the behavior of 
the internal producer of Geo-Replicator,   
+
+# Motivation
+
+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.
+
+- Users want to maintain pulsar resources manually.
+- Users pulsar resources using `GitOps CD` automated deployment, for which
+  - Clusters are deployed simultaneously without user intervention.
+  - Each cluster is precisely configured from git repo config variables - 
including the list of all tenants/namespaces/topics to be created in each 
cluster.
+  - Clusters are configured to be exact clones of each other in terms of 
pulsar resources.
+
+**Passed 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.
+
+# Goals
+
+Introduce a flag to disable the replicators to automatically trigger topic 
creation.
+
+# Detailed Design
+
+## Configuration
+
+**broker.conf**
+```properties
+# It is not a dynamic config, the default value is "true" to preserve 
backward-compatible behavior.
+# See details below.
+replicationTriggerRemoteTopicCreation=true
+```
+
+## Design & Implementation Details
+
+- If `replicationTriggerRemoteTopicCreation` is set to `false`.
+  1. After enabling namespace-level Geo-Replication: the broker will not 
create topics on the remote cluster automatically when calling `pulsar-admin 
topics create-partitioned-topic`.

Review Comment:
   > Will the topic for the remote cluster be created during the topic creation 
on the local cluster?
   
   With the current implementation, it will happen only when you call `create 
partitioned topic`. 
   - local cluster: `create partitioned topic`.
   - admin client in local cluster: calls `create partitioned topic` for remote 
cluster.
   
   This behavior guarantees that the partitions will be the same between local 
and remote clusters, so we can not move this operation to the component 
Replicator.
   
   --- 
   
   After disabling `createTopicToRemoteClusterForReplication`, it will not 
trigger the remote topics creation anymore.



-- 
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