ztzg commented on a change in pull request #934: ZOOKEEPER-3301:Enforce the 
quota limit
URL: https://github.com/apache/zookeeper/pull/934#discussion_r404009323
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/cli/DelQuotaCommand.java
 ##########
 @@ -43,11 +42,14 @@
     private CommandLine cl;
 
     public DelQuotaCommand() {
-        super("delquota", "[-n|-b] path");
+        super("delquota", "[-n|-b|-N|-B] path");
 
         OptionGroup og1 = new OptionGroup();
-        og1.addOption(new Option("b", false, "bytes quota"));
-        og1.addOption(new Option("n", false, "num quota"));
+        og1.addOption(new Option("n", false, "num soft quota"));
+        og1.addOption(new Option("b", false, "bytes soft quota"));
+        og1.addOption(new Option("N", false, "num hard quota"));
+        og1.addOption(new Option("B", false, "bytes hard quota"));
 
 Review comment:
   Not a bug you introduced—it's also in `master`—but it turns out that that 
`OptionGroup` business does not quite work as one would expect:
   
   ```
   ] create /foo
   Created /foo
   ] setquota -b 42 /foo
   ```
   
   Okay.
   
   ```
   ] create /bar
   Created /bar
   ] setquota -b 42 /bar
   ```
   
   Still okay, because we're using the `-b` flag again.   But this:
   
   ```
   ] create /baz
   Created /baz
   ] setquota -B 42 /baz
   org.apache.commons.cli.AlreadySelectedException: The option 'B' was 
specified but an option from this group has already been selected: 'b'
   ```
   
   … now fails, because the "global" `OptionGroup` object has been modified to 
mark the `-b` as in use!  I'd suggest getting rid of the `option` field, and 
recreating the `Option` "tree" for each parse.
   
   A workaround is to quit and restart the "cli" program.

----------------------------------------------------------------
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

Reply via email to