cmccabe commented on code in PR #15986:
URL: https://github.com/apache/kafka/pull/15986#discussion_r1624865998
##########
raft/src/main/java/org/apache/kafka/raft/FollowerState.java:
##########
@@ -156,22 +156,24 @@ public boolean canGrantVote(ReplicaKey candidateKey,
boolean isLogUpToDate) {
log.debug(
"Rejecting vote request from candidate ({}) since we already have
a leader {} in epoch {}",
candidateKey,
- leaderId(),
+ leader,
epoch
);
return false;
}
@Override
public String toString() {
- return "FollowerState(" +
- "fetchTimeoutMs=" + fetchTimeoutMs +
- ", epoch=" + epoch +
- ", leaderId=" + leaderId +
- ", voters=" + voters +
- ", highWatermark=" + highWatermark +
- ", fetchingSnapshot=" + fetchingSnapshot +
- ')';
+ return String.format(
Review Comment:
Personally I find `String.format` actually harder to read in the "simple"
cases where you're just printing `x=myX, y=myY`. I think where it really shines
is where you want an exotic format (like `x=%02x, y=%08d`, etc.) or where the
textual part is complex. However, I don't feel that strongly about this so you
can leave it.
--
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]