C0urante commented on code in PR #13178:
URL: https://github.com/apache/kafka/pull/13178#discussion_r1100654263


##########
connect/mirror/src/main/java/org/apache/kafka/connect/mirror/OffsetSyncStore.java:
##########
@@ -56,8 +56,7 @@ OptionalLong translateDownstream(TopicPartition 
sourceTopicPartition, long upstr
                 // Offset is too far in the past to translate accurately
                 return OptionalLong.of(-1L);
             }
-            long upstreamStep = upstreamOffset - 
offsetSync.get().upstreamOffset();
-            return OptionalLong.of(offsetSync.get().downstreamOffset() + 
upstreamStep);
+            return OptionalLong.of(offsetSync.get().downstreamOffset() + 
(offsetSync.get().upstreamOffset() == upstreamOffset ? 0 : 1));

Review Comment:
   IMO the diagram is a bit overkill, but I tend not to be a very visual 
thinker. It certainly doesn't do any harm; I'm fine with leaving it in. Thanks 
for adding detail here, hopefully it'll come in handy if anyone needs to 
revisit this logic in the future.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to