hachikuji commented on a change in pull request #10309:
URL: https://github.com/apache/kafka/pull/10309#discussion_r598980860
##########
File path: raft/src/main/java/org/apache/kafka/raft/LeaderState.java
##########
@@ -33,22 +36,25 @@
* they acknowledge the leader.
*/
public class LeaderState implements EpochState {
+ static final long OBSERVER_SESSION_TIMEOUT_MS = 300_000L;
+
private final int localId;
private final int epoch;
private final long epochStartOffset;
private Optional<LogOffsetMetadata> highWatermark;
- private final Map<Integer, VoterState> voterReplicaStates = new
HashMap<>();
- private final Map<Integer, ReplicaState> observerReplicaStates = new
HashMap<>();
+ private final Map<Integer, ReplicaState> voterStates = new HashMap<>();
+ private final Map<Integer, ReplicaState> observerStates = new HashMap<>();
private final Set<Integer> grantingVoters = new HashSet<>();
- private static final long OBSERVER_SESSION_TIMEOUT_MS = 300_000L;
+ private final Logger log;
protected LeaderState(
int localId,
int epoch,
long epochStartOffset,
Set<Integer> voters,
- Set<Integer> grantingVoters
+ Set<Integer> grantingVoters,
+ LogContext logContext
Review comment:
The log context is useful because it carries with it a logging prefix
which can be used to distinguish log messages. For example, in a streams
application, the fact that we have multiple producers can make debugging
difficult. Or in the context of integration/system/simulation testing, we often
get logs from multiple nodes mixed together. With a common prefix, it is easy
to grep messages for a particular instance so long as the `LogContext` is
carried through to all the dependencies. Sometimes it is a little annoying to
add the extra parameter, but it is worthwhile for improved debugging whenever
the parent object already has a log context.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]