linyiqun commented on a change in pull request #1445:
URL: https://github.com/apache/ozone/pull/1445#discussion_r541497229



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketDeleteRequest.java
##########
@@ -134,9 +135,23 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
       omResponse.setDeleteBucketResponse(
           DeleteBucketResponse.newBuilder().build());
 
+      // update used namespace for volume
+      String volumeKey = omMetadataManager.getVolumeKey(volumeName);
+      OmVolumeArgs omVolumeArgs =
+          omMetadataManager.getVolumeTable().getReadCopy(volumeKey);
+      if (omVolumeArgs == null) {
+        throw new OMException("Volume " + volumeName + " is not found",
+            OMException.ResultCodes.VOLUME_NOT_FOUND);
+      }
+      omVolumeArgs.incrUsedNamespace(-1L);
+      // Update table cache.
+      omMetadataManager.getVolumeTable().addCacheEntry(
+          new CacheKey<>(omMetadataManager.getVolumeKey(volumeName)),

Review comment:
       We could directly use volumeKey, don't need to invoke 
omMetadataManager.getVolumeKey again.

##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketCreateRequest.java
##########
@@ -301,6 +309,25 @@ private BucketEncryptionInfoProto getBeinfo(
     return bekb.build();
   }
 
+  /**
+   * Check namespace quota.
+   */
+  private void checkQuotaInNamespace(OmVolumeArgs omVolumeArgs,
+      long allocatedNamespace) throws IOException {
+    if (omVolumeArgs.getQuotaInCounts() > OzoneConsts.QUOTA_RESET) {
+      long usedNamespace = omVolumeArgs.getUsedNamespace();

Review comment:
       Can you use omVolumeArgs.getQuotaInCounts() != OzoneConsts.QUOTA_RESET 
to replace above condition check? That will be the better check in case maybe 
OzoneConsts.QUOTA_RESET value can be changed to the positive number.




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

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