ahuang98 commented on code in PR #16079: URL: https://github.com/apache/kafka/pull/16079#discussion_r1626330605
########## raft/src/main/java/org/apache/kafka/raft/LeaderState.java: ########## @@ -435,16 +438,40 @@ private DescribeQuorumResponseData.ReplicaState describeReplicaState( } + /** + * Clear observer states that have not been active for a while and are not the leader. + */ private void clearInactiveObservers(final long currentTimeMs) { observerStates.entrySet().removeIf(integerReplicaStateEntry -> - currentTimeMs - integerReplicaStateEntry.getValue().lastFetchTimestamp >= OBSERVER_SESSION_TIMEOUT_MS + currentTimeMs - integerReplicaStateEntry.getValue().lastFetchTimestamp >= OBSERVER_SESSION_TIMEOUT_MS && + integerReplicaStateEntry.getKey() != localId ); } private boolean isVoter(int remoteNodeId) { return voterStates.containsKey(remoteNodeId); } + private void updateVoterAndObserverStates(Set<Integer> lastVoterSet) { Review Comment: Hm, actually seems we can test this pretty directly with `describeQuorum`. I'll add another test. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org