ChenSammi commented on a change in pull request #1434:
URL: https://github.com/apache/hadoop-ozone/pull/1434#discussion_r495521089



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMAllocateBlockRequest.java
##########
@@ -227,6 +232,18 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
     } catch (IOException ex) {
       omMetrics.incNumBlockAllocateCallFails();
       exception = ex;
+      if (exception.toString().contains(
+          OMException.ResultCodes.QUOTA_EXCEEDED.toString())) {
+        long keyAllocatedSpace = openKeyInfo.getLatestVersionLocations()
+            .getLocationListCount() * ozoneManager.getScmBlockSize()
+            * openKeyInfo.getFactor().getNumber();
+        // Update usedBytes atomically. ErrorOMResponse does not persist the 
DB,
+        // so we update the cache first. The next time another key is written,
+        // volume Args will be persisted to the DB.
+        // TODO: There is a delay in updating DB in this way, and if necessary
+        //  we can modify the ErrorOMResponse to avoid it.
+        omVolumeArgs.getUsedBytes().add(-keyAllocatedSpace);

Review comment:
       If A object has multiple blocks, and quota_exceeded exception is thrown 
out at the last block, shall we only deduct the block space size at this step? 




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to