-
Notifications
You must be signed in to change notification settings - Fork 14.7k
KAFKA-18509 Move StateChangeLogger to server-common module #20637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-18509 Move StateChangeLogger to server-common module #20637
Conversation
import org.slf4j.LoggerFactory; | ||
|
||
public class StateChangeLogger { | ||
private static final Logger log = LoggerFactory.getLogger("state.change.logger"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOGGER
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class StateChangeLogger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add comments explaining the purpose of this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, test this patch locally, and it works well
astraea@4d06546d9896:/opt/kafka$ cat logs/state-change.log
[2025-10-06 14:49:48,720] INFO [Broker id=10686] Transitioning 1 partition(s) to local leaders. (state.change.logger)
[2025-10-06 14:49:48,722] INFO [Broker id=10686] Creating new partition chia-0 with topic id SSROqblKQnylcx-1TgPrPA. (state.change.logger)
[2025-10-06 14:49:48,735] INFO [Broker id=10686] Leader chia-0 with topic id Some(SSROqblKQnylcx-1TgPrPA) starts at leader epoch 0 from offset 0 with partition epoch 0, high watermark 0, ISR [10686], adding replicas [] and removing replicas [] . Previous leader None and previous leader epoch was -1. (state.change.logger)
[2025-10-06 14:49:48,891] INFO [Broker id=10686] Transitioning 1 partition(s) to local leaders. (state.change.logger)
[2025-10-06 14:49:48,900] INFO [Broker id=10686] Skipped the become-leader state change for chia-0 with topic id Some(SSROqblKQnylcx-1TgPrPA), partition registration PartitionRegistration(replicas=[10686], directories=[_Q5ubnelBuH_WhzwMDjmjA], isr=[10686], removingReplicas=[], addingReplicas=[], elr=[], lastKnownElr=[], leader=10686, leaderRecoveryState=RECOVERED, leaderEpoch=0, partitionEpoch=1) and isNew=false since it is already the leader with leader epoch 0. Current high watermark 0, ISR [10686], adding replicas [] and removing replicas []. (state.change.logger)
the failed test is handled by #20620 |
We can rewrite this class from scala to java and move to server-common
module. To maintain backward compatibility, we should keep the logger
name
state.change.logger
.Reviewers: Chia-Ping Tsai [email protected]