nodece commented on code in PR #22577:
URL: https://github.com/apache/pulsar/pull/22577#discussion_r1579030734


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/OneWayReplicatorTest.java:
##########
@@ -652,4 +652,63 @@ public void testUnFenceTopicToReuse() throws Exception {
             admin2.topics().delete(topicName);
         });
     }
+
+    @Test
+    public void testNamespaceLevelReplicationRemoteConflictTopicExist() throws 
Exception {
+        final String topicName = BrokerTestUtil.newUniqueName("persistent://" 
+ replicatedNamespace + "/tp");
+        // Verify: will get a not found error when calling 
"getPartitionedTopicMetadata" on a topic not exists.
+        try {
+            admin1.topics().getPartitionedTopicMetadata(topicName);
+            fail("Expected a not found error");
+        } catch (Exception ex) {
+            Throwable unWrapEx = FutureUtil.unwrapCompletionException(ex);
+            assertTrue(unWrapEx.getMessage().contains("not found"));
+        }
+        // Verify: will get a conflict error when there is a topic with 
different partitions on the remote side.
+        admin2.topics().createPartitionedTopic(topicName, 1);
+        try {
+            admin1.topics().createPartitionedTopic(topicName, 2);

Review Comment:
   >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?
   
   Sorry, I didn't consider your PR. 
   
   If there isn't this PR,  the local cluster will do that.
   
   > No, regarding this test case, the messages that were sent to `partition-1` 
will never be copied to the remote cluster because `partition-1` can not be 
created successfully.
   
   There will still be some issues here:
   
   1. If the remote cluster's topic equals the topic that will be created, how 
to handle it?
   
   2. How to roll back a remote cluster's topic if the remote cluster's topic 
created the cluster successfully, but the local cluster's creation failed.
   
   > Without this fix, the broker eats the error, and users assume all things 
are fine. It is not correct.
   
   I understand here, so we have overlooked this error.
   
   There is a possibility of contaminating the topic of the remote cluster here.



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