mjsax commented on code in PR #18115:
URL: https://github.com/apache/kafka/pull/18115#discussion_r1880953337


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopologyBuilder.java:
##########
@@ -1347,19 +1360,30 @@ private <S extends StateStore> InternalTopicConfig 
createChangelogTopicConfig(fi
     }
 
     public boolean hasOffsetResetOverrides() {
-        return !(earliestResetTopics.isEmpty() && 
earliestResetPatterns.isEmpty()
-            && latestResetTopics.isEmpty() && latestResetPatterns.isEmpty());
+        return noneResetTopics.size() + noneResetPatterns.size()
+            + earliestResetTopics.size() + earliestResetPatterns.size()
+            + latestResetTopics.size() + latestResetPatterns.size()
+            + durationResetTopics.size() + durationResetPatterns.size() > 0;
     }
 
     public AutoOffsetResetStrategy offsetResetStrategy(final String topic) {
-        if 
(maybeDecorateInternalSourceTopics(earliestResetTopics).contains(topic) ||
+        Optional<Duration> resetDuration;
+
+        if (maybeDecorateInternalSourceTopics(noneResetTopics).contains(topic) 
||
+            noneResetPatterns.stream().anyMatch(p -> 
p.matcher(topic).matches())) {
+            return AutoOffsetResetStrategy.NONE;
+        } else if 
(maybeDecorateInternalSourceTopics(earliestResetTopics).contains(topic) ||
             earliestResetPatterns.stream().anyMatch(p -> 
p.matcher(topic).matches())) {
             return AutoOffsetResetStrategy.EARLIEST;
         } else if 
(maybeDecorateInternalSourceTopics(latestResetTopics).contains(topic) ||
             latestResetPatterns.stream().anyMatch(p -> 
p.matcher(topic).matches())) {
             return AutoOffsetResetStrategy.LATEST;
+        } else if 
(maybeDecorateInternalSourceTopics(durationResetTopics.keySet()).contains(topic))
 {
+            return AutoOffsetResetStrategy.fromString("by_duration:" + 
durationResetTopics.get(topic).toString());
+        } else if ((resetDuration = findDuration(topic)).isPresent()) {
+            return AutoOffsetResetStrategy.fromString("by_duration:" + 
resetDuration.get());
         } else if (containsTopic(topic)) {
-            return AutoOffsetResetStrategy.NONE;
+            return null;

Review Comment:
   We need one more "condition" now that we support "none"... We return NONE 
above now.
   
   This NONE was kinda weird -- we used it to indicate "topic has not per-topic 
reset policy -> use the one from StreamsConfig" -- what was semantically 
incorrect to begin with (but it was internal code, so it did not really matter).
   
   Does this make sense?



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