adoroszlai commented on a change in pull request #1412:
URL: https://github.com/apache/hadoop-ozone/pull/1412#discussion_r496617299



##########
File path: 
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
##########
@@ -441,6 +431,8 @@ public void createBucket(
     verifyVolumeName(volumeName);
     verifyBucketName(bucketName);
     Preconditions.checkNotNull(bucketArgs);
+    verifyCountsQuota(bucketArgs.getQuotaInCounts());
+    verifySpaceQuota(bucketArgs.getQuotaInBytes());

Review comment:
       `createBucket` verifies quota args, but `createVolume` does not.  Is 
this intentional?

##########
File path: 
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
##########
@@ -305,8 +300,8 @@ public void createVolume(String volumeName, VolumeArgs 
volArgs)
     builder.setVolume(volumeName);
     builder.setAdminName(admin);
     builder.setOwnerName(owner);
-    builder.setQuotaInBytes(quotaInBytes);
-    builder.setQuotaInCounts(quotaInCounts);
+    builder.setQuotaInBytes(getQuotaValue(volArgs.getQuotaInBytes()));
+    builder.setQuotaInCounts(getQuotaValue(volArgs.getQuotaInCounts()));

Review comment:
       Arguments are already checked, why change from use of the variables to 
`getQuotaValue`?
   
   ```suggestion
       builder.setQuotaInBytes(quotaInBytes);
       builder.setQuotaInCounts(quotaInCounts);
   ```

##########
File path: 
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/ClearQuotaHandler.java
##########
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.shell.bucket;
+
+import org.apache.hadoop.ozone.client.OzoneBucket;
+import org.apache.hadoop.ozone.client.OzoneClient;
+import org.apache.hadoop.ozone.shell.OzoneAddress;
+import org.apache.hadoop.ozone.shell.ClearSpaceQuotaOptions;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+import java.io.IOException;
+
+/**
+ * clean quota of the bucket.
+ */
+@Command(name = "clrquota",
+    description = "clear quota of the bucket")
+public class ClearQuotaHandler extends BucketHandler {
+
+  @CommandLine.Mixin
+  private ClearSpaceQuotaOptions clrSpaceQuota;
+
+  @CommandLine.Option(names = {"--key-quota"},
+      description = "clear count quota")
+  private boolean clrKeyQuota;

Review comment:
       By using a bit more generic option name `--count-quota`, this could be 
moved into `ClearSpaceQuotaOptions` (and unified with volume's `--bucket-quota` 
option).

##########
File path: 
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java
##########
@@ -46,6 +49,13 @@
           "false/unspecified indicates otherwise")
   private Boolean isGdprEnforced;
 
+  @CommandLine.Mixin
+  private SetSpaceQuotaOptions quotaOptions;
+
+  @Option(names = {"--key-quota"},
+      description = "Key counts of the newly created bucket (eg. 5)")
+  private long quotaInCounts = OzoneConsts.QUOTA_RESET;

Review comment:
       Similarly to the option for `ClearQuotaHandler`:
   
   by using a bit more generic option name `--count-quota` (and description), 
this could be moved into `SetSpaceQuotaOptions` (and unified with volume's 
`--bucket-quota` option).




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to