You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ahuang98 (via GitHub)" <gi...@apache.org> on 2024/07/31 21:15:04 UTC
[PR] KAFKA-16521: kafka-metadata-quorum describe command changes for KIP-853 [kafka]
ahuang98 opened a new pull request, #16759:
URL: https://github.com/apache/kafka/pull/16759
`describe --status` now includes directory id and endpoint information for voter and observers.
`describe --replication` now includes directory id.
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16521: kafka-metadata-quorum describe command changes for KIP-853 [kafka]
Posted by "jsancio (via GitHub)" <gi...@apache.org>.
jsancio commented on PR #16759:
URL: https://github.com/apache/kafka/pull/16759#issuecomment-2263810180
> It looks like we want to include a CommittedVoters: field as well, I think we can include it in a later PR given that it will require some larger changes to plumb that information through.
@ahuang98 I agree. Can you file an issue under https://issues.apache.org/jira/browse/KAFKA-17241 to implement this?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16521: kafka-metadata-quorum describe command changes for KIP-853 [kafka]
Posted by "jsancio (via GitHub)" <gi...@apache.org>.
jsancio merged PR #16759:
URL: https://github.com/apache/kafka/pull/16759
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16521: kafka-metadata-quorum describe command changes for KIP-853 [kafka]
Posted by "ahuang98 (via GitHub)" <gi...@apache.org>.
ahuang98 commented on PR #16759:
URL: https://github.com/apache/kafka/pull/16759#issuecomment-2263935541
https://issues.apache.org/jira/browse/KAFKA-17243
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16521: kafka-metadata-quorum describe command changes for KIP-853 [kafka]
Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #16759:
URL: https://github.com/apache/kafka/pull/16759#discussion_r1699154238
##########
tools/src/main/java/org/apache/kafka/tools/MetadataQuorumCommand.java:
##########
@@ -232,9 +235,60 @@ else if (leader.lastCaughtUpTimestamp().isPresent() && maxLagFollower.lastCaught
"\nHighWatermark: " + quorumInfo.highWatermark() +
"\nMaxFollowerLag: " + maxFollowerLag +
"\nMaxFollowerLagTimeMs: " + maxFollowerLagTimeMs +
- "\nCurrentVoters: " + quorumInfo.voters().stream().map(QuorumInfo.ReplicaState::replicaId).map(Object::toString).collect(Collectors.joining(",", "[", "]")) +
- "\nCurrentObservers: " + quorumInfo.observers().stream().map(QuorumInfo.ReplicaState::replicaId).map(Objects::toString).collect(Collectors.joining(",", "[", "]"))
+ "\nCurrentVoters: " + printVoterState(quorumInfo) +
+ "\nCurrentObservers: " + printObserverState(quorumInfo)
);
}
+ // Constructs the CurrentVoters string
+ // CurrentVoters: [{"id": 0, "directoryId": "UUID1", "endpoints": [{"name": "C", "securityProtocol": "SSL", "host": "controller-0", "port": 1234}]}, {"id": 1, ... }]}]
+ private static String printVoterState(QuorumInfo quorumInfo) {
+ return printReplicaState(quorumInfo, quorumInfo.voters());
+ }
+
+ // Constructs the CurrentObservers string
+ private static String printObserverState(QuorumInfo quorumInfo) {
+ return printReplicaState(quorumInfo, quorumInfo.observers());
+ }
+
+ private static String printReplicaState(QuorumInfo quorumInfo, List<QuorumInfo.ReplicaState> replicas) {
+ List<Node> currentVoterList = replicas.stream().map(voter -> new Node(
+ voter.replicaId(),
+ voter.replicaDirectoryId(),
+ getEndpoints(quorumInfo.nodes().get(voter.replicaId())))).collect(Collectors.toList());
+ return currentVoterList.stream().map(Objects::toString).collect(Collectors.joining(", ", "[", "]"));
+ }
+
+ private static List<RaftVoterEndpoint> getEndpoints(QuorumInfo.Node node) {
+ return node == null ? new ArrayList<>() : node.endpoints();
+ }
+
+ private static class Node {
+ private final int id;
+ private final Uuid directoryId;
+ private final List<RaftVoterEndpoint> endpoints;
+
+ private Node(int id, Uuid directoryId, List<RaftVoterEndpoint> endpoints) {
+ this.id = id;
+ this.directoryId = directoryId;
+ this.endpoints = endpoints;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("{");
+ sb.append("\"id\": ").append(id).append(", ");
Review Comment:
If it's UUID_ZERO should we print out something special (like "none")?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-16521: kafka-metadata-quorum describe command changes for KIP-853 [kafka]
Posted by "cmccabe (via GitHub)" <gi...@apache.org>.
cmccabe commented on code in PR #16759:
URL: https://github.com/apache/kafka/pull/16759#discussion_r1699153956
##########
tools/src/main/java/org/apache/kafka/tools/MetadataQuorumCommand.java:
##########
@@ -232,9 +235,60 @@ else if (leader.lastCaughtUpTimestamp().isPresent() && maxLagFollower.lastCaught
"\nHighWatermark: " + quorumInfo.highWatermark() +
"\nMaxFollowerLag: " + maxFollowerLag +
"\nMaxFollowerLagTimeMs: " + maxFollowerLagTimeMs +
- "\nCurrentVoters: " + quorumInfo.voters().stream().map(QuorumInfo.ReplicaState::replicaId).map(Object::toString).collect(Collectors.joining(",", "[", "]")) +
- "\nCurrentObservers: " + quorumInfo.observers().stream().map(QuorumInfo.ReplicaState::replicaId).map(Objects::toString).collect(Collectors.joining(",", "[", "]"))
+ "\nCurrentVoters: " + printVoterState(quorumInfo) +
+ "\nCurrentObservers: " + printObserverState(quorumInfo)
);
}
+ // Constructs the CurrentVoters string
+ // CurrentVoters: [{"id": 0, "directoryId": "UUID1", "endpoints": [{"name": "C", "securityProtocol": "SSL", "host": "controller-0", "port": 1234}]}, {"id": 1, ... }]}]
+ private static String printVoterState(QuorumInfo quorumInfo) {
+ return printReplicaState(quorumInfo, quorumInfo.voters());
+ }
+
+ // Constructs the CurrentObservers string
+ private static String printObserverState(QuorumInfo quorumInfo) {
+ return printReplicaState(quorumInfo, quorumInfo.observers());
+ }
+
+ private static String printReplicaState(QuorumInfo quorumInfo, List<QuorumInfo.ReplicaState> replicas) {
+ List<Node> currentVoterList = replicas.stream().map(voter -> new Node(
+ voter.replicaId(),
+ voter.replicaDirectoryId(),
+ getEndpoints(quorumInfo.nodes().get(voter.replicaId())))).collect(Collectors.toList());
+ return currentVoterList.stream().map(Objects::toString).collect(Collectors.joining(", ", "[", "]"));
+ }
+
+ private static List<RaftVoterEndpoint> getEndpoints(QuorumInfo.Node node) {
+ return node == null ? new ArrayList<>() : node.endpoints();
+ }
+
+ private static class Node {
+ private final int id;
+ private final Uuid directoryId;
+ private final List<RaftVoterEndpoint> endpoints;
+
+ private Node(int id, Uuid directoryId, List<RaftVoterEndpoint> endpoints) {
+ this.id = id;
+ this.directoryId = directoryId;
+ this.endpoints = endpoints;
Review Comment:
would it be simpler to just do `Objects.requireNonNull` here and skip the null checks in toString? I don't see any way endpoints could be initialized as null here. Same question for `directoryId`.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org