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
32064d5b42
commit
ef9f6fb7fe
|
@ -156,7 +156,10 @@ public class LeaderState<T> implements EpochState {
|
||||||
"Current fetched voters are {}, and voters are {}",
|
"Current fetched voters are {}, and voters are {}",
|
||||||
checkQuorumTimeoutMs,
|
checkQuorumTimeoutMs,
|
||||||
fetchedVoters,
|
fetchedVoters,
|
||||||
voterStates.values().stream().map(voter -> voter.replicaKey)
|
voterStates.values()
|
||||||
|
.stream()
|
||||||
|
.map(voter -> voter.replicaKey)
|
||||||
|
.collect(Collectors.toUnmodifiableSet())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return remainingMs;
|
return remainingMs;
|
||||||
|
|
|
@ -70,7 +70,7 @@ public final class ReplicaKey implements Comparable<ReplicaKey> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
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) {
|
public static ReplicaKey of(int id, Uuid directoryId) {
|
||||||
|
|
Loading…
Reference in New Issue