You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "sadanand48 (via GitHub)" <gi...@apache.org> on 2023/04/05 09:22:12 UTC
[GitHub] [ozone] sadanand48 commented on a diff in pull request #4529: HDDS-8367. setquota should have a check on usedNamespace [NameSpacequota]
sadanand48 commented on code in PR #4529:
URL: https://github.com/apache/ozone/pull/4529#discussion_r1158249472
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/OMVolumeSetQuotaRequest.java:
##########
@@ -228,11 +227,24 @@ public boolean checkQuotaBytesValid(OMMetadataManager metadataManager,
return true;
}
- public boolean checkQuotaNamespaceValid(long quotaInNamespace) {
-
+ public boolean checkQuotaNamespaceValid(OMMetadataManager metadataManager,
+ long quotaInNamespace, String volumeName) throws IOException {
if (quotaInNamespace < OzoneConsts.QUOTA_RESET || quotaInNamespace == 0) {
return false;
}
+
+ // if volume quota is for reset, no need further check
+ if (quotaInNamespace == OzoneConsts.QUOTA_RESET) {
+ return true;
+ }
+
+ List<OmBucketInfo> bucketList = metadataManager.listBuckets(
+ volumeName, null, null, Integer.MAX_VALUE);
+ if (bucketList.size() > quotaInNamespace) {
Review Comment:
Doesn't volume namespace quota mean the Sum(all bucket namespace quotas) ?
According this code here volume namespace quota = number of buckets in volume as we are checking `bucketList.size()`
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/OMVolumeSetQuotaRequest.java:
##########
@@ -94,9 +94,8 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
OMResponse.Builder omResponse = OmResponseUtil.getOMResponseBuilder(
getOmRequest());
- // In production this will never happen, this request will be called only
- // when we have quota in bytes is set in setVolumePropertyRequest.
- if (!setVolumePropertyRequest.hasQuotaInBytes()) {
+ if (!setVolumePropertyRequest.hasQuotaInBytes()
+ && !setVolumePropertyRequest.hasQuotaInNamespace()) {
Review Comment:
This means every set volume request needs to include a namespace quota param in its request, If I just want to change space quota does the request populate namespace quota by default?
--
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