You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/06/10 14:58:30 UTC

[GitHub] [kafka] mimaison commented on a change in pull request #10652: KAFKA-9726 IdentityReplicationPolicy

mimaison commented on a change in pull request #10652:
URL: https://github.com/apache/kafka/pull/10652#discussion_r649253273



##########
File path: connect/mirror-client/src/test/java/org/apache/kafka/connect/mirror/MirrorClientTest.java
##########
@@ -159,4 +191,12 @@ public void remoteTopicsSeparatorTest() throws InterruptedException {
         assertTrue(remoteTopics.contains("source3__source4__source5__topic6"));
     }
 
+    public void testIdentityReplicationTopicSource() {

Review comment:
       Missing `@Test` annotation

##########
File path: connect/mirror/src/main/java/org/apache/kafka/connect/mirror/MirrorSourceConnector.java
##########
@@ -492,7 +492,12 @@ boolean isCycle(String topic) {
         } else if (source.equals(sourceAndTarget.target())) {
             return true;
         } else {
-            return isCycle(replicationPolicy.upstreamTopic(topic));
+            String upstreamTopic = replicationPolicy.upstreamTopic(topic);
+            if (upstreamTopic.equals(topic)) {

Review comment:
       Can we cover this new branch with a test in `MirrorSourceConnectorTest`?

##########
File path: connect/mirror-client/src/test/java/org/apache/kafka/connect/mirror/MirrorClientTest.java
##########
@@ -159,4 +191,12 @@ public void remoteTopicsSeparatorTest() throws InterruptedException {
         assertTrue(remoteTopics.contains("source3__source4__source5__topic6"));
     }
 
+    public void testIdentityReplicationTopicSource() {
+        MirrorClient client = new FakeMirrorClient(
+            new IdentityReplicationPolicy("primary"), Arrays.asList());
+        assertEquals("topic1", client.replicationPolicy()
+            .formatRemoteTopic("primary", "topic1"));

Review comment:
       Should we also try `formatRemoteTopic()` with a heartbeat topic?

##########
File path: connect/mirror-client/src/main/java/org/apache/kafka/connect/mirror/MirrorClient.java
##########
@@ -60,7 +60,7 @@
     private ReplicationPolicy replicationPolicy;
     private Map<String, Object> consumerConfig;
 
-    public MirrorClient(Map<String, Object> props) {
+    public MirrorClient(Map<String, ?> props) {

Review comment:
       Is this actually needed?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org