You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "rondagostino (via GitHub)" <gi...@apache.org> on 2023/05/30 21:36:44 UTC

[GitHub] [kafka] rondagostino commented on a diff in pull request #13780: KAFKA-15039: Reduce logging level to trace in PartitionChangeBuilder.…

rondagostino commented on code in PR #13780:
URL: https://github.com/apache/kafka/pull/13780#discussion_r1210847987


##########
metadata/src/main/java/org/apache/kafka/controller/PartitionChangeBuilder.java:
##########
@@ -220,13 +220,15 @@ private boolean isValidNewLeader(int replica) {
     private void tryElection(PartitionChangeRecord record) {
         ElectionResult electionResult = electLeader();
         if (electionResult.node != partition.leader) {
-            log.debug(
-                "Setting new leader for topicId {}, partition {} to {} using {} election",
-                topicId,
-                partitionId,
-                electionResult.node,
-                electionResult.unclean ? "an unclean" : "a clean"
-            );
+            if (log.isTraceEnabled()) {
+                log.trace(
+                    "Setting new leader for topicId {}, partition {} to {} using {} election",
+                    topicId,
+                    partitionId,
+                    electionResult.node,
+                    electionResult.unclean ? "an unclean" : "a clean"

Review Comment:
   I don't think it is possible to do so since we don't know the result of the election anywhere else.  Unclean leader election may be enabled, for example, but it may not ever occur.  It is only here that we know.  I added additional logic to ensure that we will always log an unclean election at the WARN level.



-- 
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-unsubscribe@kafka.apache.org

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