Skip to content

Commit

Permalink
GH-2991: Fix unwanted warning logs in KMLC
Browse files Browse the repository at this point in the history
Fixes: #2991

There is a warning log from `KafkaMessageListenerContainter#checkRebalanceCommits`
that unconditionally prints that offsets could not be committed. Because of this
unconditional check, the messages are very likely to be false positives. Fixing
this by adding a check to see if there are indeed uncommitted records.

(cherry picked from commit f9476a3)
  • Loading branch information
sobychacko authored and artembilan committed Jan 17, 2024
1 parent e36c22c commit c671246
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -159,6 +159,7 @@
* @author Tomaz Fernandes
* @author Francois Rosiere
* @author Daniel Gentes
* @author Soby Chacko
*/
public class KafkaMessageListenerContainer<K, V> // NOSONAR line count
extends AbstractMessageListenerContainer<K, V> implements ConsumerPauseResumeEventPublisher {
Expand Down Expand Up @@ -1711,9 +1712,10 @@ private void checkRebalanceCommits() {
.stream()
.filter(entry -> !this.assignedPartitions.contains(entry.getKey()))
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
this.logger.warn(() -> "These offsets could not be committed; partition(s) lost during rebalance: "
+ uncommitted);

if (!uncommitted.isEmpty()) {
this.logger.warn(() -> "These offsets could not be committed; partition(s) lost during rebalance: "
+ uncommitted);
}
this.commitsDuringRebalance.clear();
this.logger.debug(() -> "Commit list: " + commits);
commitSync(commits);
Expand Down

0 comments on commit c671246

Please sign in to comment.