[fix] [broker] [Namespace-level Geo-Replication] Reject a topic creation if there is a confilct topic on the remote side
Motivation
The steps to describe the issue
- There is a partitioned topic on the remote cluster, with partitions
1. And the source cluster does not have this topic. - Enable namespace-level Geo-Replication.
- Create the topic with
3partitions on the source cluster. - The broker just printed an error log "[Error] This topic already exists", and users get a successful response.
Modifications
Reject a topic creation if there is a conflict topic on the remote side
Documentation
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
Matching PR in forked repository
PR in forked repository: x
I think we intentionally overlooked the result of creating a topic for the remote cluster.
This PR may break the user's behavior of creating topic.
According to your description, when using the default broker configuration, and the geo-replication is enabled on the namespace level, the remote cluster will create two non-partitioned topics, tenant/namespace/topic-partition-1 and tenant/namespace/topic-partition-2 by the geo producer. Is it right?
If right, I would suggest adding a topic check before starting the replicator to make sure that the topic is the same between local and remote clusters, if they are the same, start the replicator, otherwise throw a log. You can also add this check in the replicator task.
Rebase master
Rebase master