mirror of https://github.com/apache/kafka.git
KAFKA-18131: Improve logs for voters (#18028)
Currently, the log of LeaderState#timeUntilCheckQuorumExpires uses streams without a terminal operator, resulting in output like java.util.stream.ReferencePipeline$3@39660237. This PR aims to fix this issue and improve the log message. Reviewers: Luke Chen <showuon@gmail.com>
This commit is contained in:
parent
b9354d6886
commit
2e4a378c27
|
@ -156,7 +156,10 @@ public class LeaderState<T> implements EpochState {
|
|||
"Current fetched voters are {}, and voters are {}",
|
||||
checkQuorumTimeoutMs,
|
||||
fetchedVoters,
|
||||
voterStates.values().stream().map(voter -> voter.replicaKey)
|
||||
voterStates.values()
|
||||
.stream()
|
||||
.map(voter -> voter.replicaKey)
|
||||
.collect(Collectors.toUnmodifiableSet())
|
||||
);
|
||||
}
|
||||
return remainingMs;
|
||||
|
|
|
@ -70,7 +70,7 @@ public final class ReplicaKey implements Comparable<ReplicaKey> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("ReplicaKey(id=%d, directoryId=%s)", id, directoryId);
|
||||
return String.format("ReplicaKey(id=%d, directoryId=%s)", id, directoryId.map(Uuid::toString).orElse("<undefined>"));
|
||||
}
|
||||
|
||||
public static ReplicaKey of(int id, Uuid directoryId) {
|
||||
|
|
Loading…
Reference in New Issue