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 2022/02/25 07:22:26 UTC

[GitHub] [ozone] sodonnel commented on a change in pull request #3136: HDDS-6279. EC: Calculate EC replication correctly when updating bucket usage

sodonnel commented on a change in pull request #3136:
URL: https://github.com/apache/ozone/pull/3136#discussion_r814529935



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3MultipartUploadCommitPartRequest.java
##########
@@ -229,7 +229,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
       // AllocatedBlock. The space occupied by the Key shall be based on
       // the actual Key size, and the total Block size applied before should
       // be subtracted.
-      long correctedSpace = omKeyInfo.getDataSize() * factor -
+      long correctedSpace = omKeyInfo.getReplicatedSize() -

Review comment:
       This calculation is correct for EC keys. When a block is allocated, it adds blockSize * factor to the bucket usage, assuming the block will be filled. Factor here is:
   
   ```
   int factor = omKeyInfo.getReplicationConfig().getRequiredNodes();
   ```
   
   So for EC 3-2 it will be 5, for 6-3 it will be 9 etc. If the block was exactly filled, this would be the actual space used by the EC block including replication.
   
   When the block is completed, we calculate the actual space used, and then remove the pre-allocated amount, leave the correct valie of usage added to the bucket.




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