zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] eolivelli commented on a change in pull request #940: ZOOKEEPER-3386: Add admin command to display voting view
Date Sat, 11 May 2019 05:58:32 GMT
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message