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


##########
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:
   @sadanand48 
   Here, bucket quota is exclusive, if quota is assigned to bucket, then its 
reserved by the bucket. So that is considered, not used byte.
   Otherwise, if total quota may cross in case
   bucket with quota -- used one is less
   other bucket object is created considering only use one
   later bucket with quota is occupied (considering reserved quota)
   Then total bucket used quota may exceed



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