MINOR: fix incorrect offset reset logging (#20558)

We need to only pass in the reset strategy, as the `logMessage`
parameter was removed.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>, Lucas Brutschy
 <lbrutschy@confluent.io>
This commit is contained in:
Matthias J. Sax 2025-09-22 09:54:50 -07:00
parent 93c4dc1d27
commit eeafe0a101
1 changed files with 6 additions and 5 deletions

View File

@ -1524,6 +1524,7 @@ public class StreamThread extends Thread implements ProcessingThread {
try {
records = mainConsumer.poll(pollTime);
} catch (final InvalidOffsetException e) {
log.info("Found no valid offset for {} partitions, resetting.", e.partitions().size());
resetOffsets(e.partitions(), e);
}
@ -1598,14 +1599,14 @@ public class StreamThread extends Thread implements ProcessingThread {
addToResetList(
partition,
seekToBeginning,
"Setting topic '{}' to consume from earliest offset",
"Setting topic '{}' to consume from 'earliest' offset",
loggedTopics
);
} else if (resetPolicy == AutoOffsetResetStrategy.LATEST) {
addToResetList(
partition,
seekToEnd,
"Setting topic '{}' to consume from latest offset",
"Setting topic '{}' to consume from 'latest' offset",
loggedTopics
);
} else if (resetPolicy.type() == AutoOffsetResetStrategy.StrategyType.BY_DURATION) {
@ -1613,7 +1614,7 @@ public class StreamThread extends Thread implements ProcessingThread {
partition,
seekByDuration,
resetPolicy.duration().get(),
"Setting topic '{}' to consume from by_duration:{}",
"Setting topic '{}' to consume from 'by_duration:{}'",
resetPolicy.duration().get().toString(),
loggedTopics
);
@ -1729,12 +1730,12 @@ public class StreamThread extends Thread implements ProcessingThread {
private void addToResetList(
final TopicPartition partition,
final Set<TopicPartition> partitions,
final String resetPolicy,
final String logMessage,
final Set<String> loggedTopics
) {
final String topic = partition.topic();
if (loggedTopics.add(topic)) {
log.info("Setting topic '{}' to consume from {} offset", topic, resetPolicy);
log.info(logMessage, topic);
}
partitions.add(partition);
}