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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]