ableegoldman commented on code in PR #18115:
URL: https://github.com/apache/kafka/pull/18115#discussion_r1881097243
##########
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:
ah, that makes sense. thanks
--
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]