You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/11/18 06:50:47 UTC

[GitHub] [ozone] kerneltime commented on a diff in pull request #3978: HDDS-7481. Set quota with reduced size than actual used do not fail

kerneltime commented on code in PR #3978:
URL: https://github.com/apache/ozone/pull/3978#discussion_r1026080947


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketSetPropertyRequest.java:
##########
@@ -306,12 +313,19 @@ public boolean checkQuotaBytesValid(OMMetadataManager metadataManager,
   }
 
   public boolean checkQuotaNamespaceValid(OmVolumeArgs omVolumeArgs,
-      OmBucketArgs omBucketArgs) {
+      OmBucketArgs omBucketArgs, OmBucketInfo dbBucketInfo)
+      throws IOException {
     long quotaInNamespace = omBucketArgs.getQuotaInNamespace();
 
     if (quotaInNamespace < OzoneConsts.QUOTA_RESET || quotaInNamespace == 0) {
       return false;
     }
+    
+    if (quotaInNamespace < dbBucketInfo.getUsedNamespace()) {
+      throw new OMException("Can not update bucket namespaceQuota less than" +
+          " used namespaceQuota.",
+          OMException.ResultCodes.QUOTA_ERROR);

Review Comment:
   ```suggestion
       if (quotaInNamespace < dbBucketInfo.getUsedNamespace()) {
         throw new OMException("Cannot update bucket quota. NamespaceQuota requested is less than" +
             " used namespaceQuota.",
             OMException.ResultCodes.QUOTA_ERROR);
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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