sadanand48 commented on code in PR #4124:
URL: https://github.com/apache/ozone/pull/4124#discussion_r1062171783


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRequest.java:
##########
@@ -536,6 +538,40 @@ protected void checkBucketQuotaInBytes(OmBucketInfo 
omBucketInfo,
             + allocateSize) + " Bytes.",
             OMException.ResultCodes.QUOTA_EXCEEDED);
       }
+    } else {
+      checkVolumeQuotaInBytes(metadataManager, omBucketInfo.getVolumeName(),
+          allocateSize);
+    }
+  }
+
+  private void checkVolumeQuotaInBytes(
+      OMMetadataManager metadataManager, String volumeName,
+      long allocateSize) throws IOException {
+    String volumeKey = metadataManager.getVolumeKey(volumeName);
+    OmVolumeArgs omVolumeArgs = metadataManager.getVolumeTable()
+        .get(volumeKey);
+    if (omVolumeArgs.getQuotaInBytes() <= OzoneConsts.QUOTA_RESET) {
+      return;
+    }
+
+    long totalBucketQuota = 0L;
+    List<OmBucketInfo> bucketList = metadataManager.listBuckets(
+        volumeName, null, null, Integer.MAX_VALUE);
+    for (OmBucketInfo bucketInfo : bucketList) {
+      long nextQuotaInBytes = bucketInfo.getQuotaInBytes();
+      if (nextQuotaInBytes > OzoneConsts.QUOTA_RESET) {
+        totalBucketQuota += nextQuotaInBytes;

Review Comment:
   If quota is enabled on the bucket then, (nextQuotaInBytes > 
OzoneConsts.QUOTA_RESET) will return true. I think even in here we need to add 
up the usedBytes of bucket instead of quota.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to