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 2023/01/06 04:22:20 UTC

[GitHub] [ozone] sumitagrawl commented on a diff in pull request #4124: HDDS-7652. Volume Quota not enforced during write when bucket quota is not set

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