eolivelli commented on a change in pull request #940: ZOOKEEPER-3386: Add admin
command to display voting view
URL: https://github.com/apache/zookeeper/pull/940#discussion_r283083857
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/admin/Commands.java
##########
@@ -573,5 +574,27 @@ public CommandResponse run(ZooKeeperServer zkServer,
Map<String, String> kwargs)
}
}
+ /**
+ * Returns the current ensemble configuration information.
+ * It provides list of current voting members in the ensemble.
+ */
+ public static class VotingViewCommand extends CommandBase {
+ public VotingViewCommand() {
+ super(Arrays.asList("voting_view"));
+ }
+
+ @Override
+ public CommandResponse run(ZooKeeperServer zkServer, Map<String,
String> kwargs) {
+ CommandResponse response = initializeResponse();
+ if (zkServer instanceof QuorumZooKeeperServer) {
+ QuorumPeer peer = ((QuorumZooKeeperServer) zkServer).self;
+ response.put("current_config", peer.getVotingView());
Review comment:
It would be better to create an explicit bean for the representation on this
endpoint (that is really like a JSON based API)
If we change the internal class we will change this API without notice.
Thoughts?
----------------------------------------------------------------
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]
With regards,
Apache Git Services