hachikuji commented on code in PR #12548:
URL: https://github.com/apache/kafka/pull/12548#discussion_r953181785
##########
raft/src/main/java/org/apache/kafka/raft/LeaderState.java:
##########
@@ -313,43 +312,70 @@ private ReplicaState getReplicaState(int remoteNodeId) {
return state;
}
- List<DescribeQuorumResponseData.ReplicaState>
quorumResponseVoterStates(long currentTimeMs) {
- return quorumResponseReplicaStates(voterStates.values(), localId,
currentTimeMs);
+ public DescribeQuorumResponseData.PartitionData describeQuorum(long
currentTimeMs) {
+ clearInactiveObservers(currentTimeMs);
+
+ return new DescribeQuorumResponseData.PartitionData()
+ .setErrorCode(Errors.NONE.code())
+ .setLeaderId(localId)
+ .setLeaderEpoch(epoch)
+ .setHighWatermark(highWatermark().map(offsetMetadata ->
offsetMetadata.offset).orElse(-1L))
+ .setCurrentVoters(describeReplicaStates(voterStates,
currentTimeMs))
+ .setObservers(describeReplicaStates(observerStates,
currentTimeMs));
}
- List<DescribeQuorumResponseData.ReplicaState>
quorumResponseObserverStates(long currentTimeMs) {
- clearInactiveObservers(currentTimeMs);
- return quorumResponseReplicaStates(observerStates.values(), localId,
currentTimeMs);
+ // Visible for testing
+ DescribeQuorumResponseData.ReplicaState describeVoterState(
Review Comment:
Makes sense.
--
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]