ChenSammi commented on code in PR #8228:
URL: https://github.com/apache/ozone/pull/8228#discussion_r2030459477


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerData.java:
##########
@@ -431,20 +437,23 @@ public long getWriteBytes() {
    * @param bytes the number of bytes write into the container.
    */
   public void incrWriteBytes(long bytes) {
-    long unused = getMaxSize() - getBytesUsed();
-
     this.writeBytes.addAndGet(bytes);
     /*
        Increase the cached Used Space in VolumeInfo as it
        maybe not updated, DU or DedicatedDiskSpaceUsage runs
        periodically to update the Used Space in VolumeInfo.
      */
     this.getVolume().incrementUsedSpace(bytes);
-    // only if container size < max size
-    if (committedSpace && unused > 0) {
-      //with this write, container size might breach max size
-      long decrement = Math.min(bytes, unused);
-      this.getVolume().incCommittedBytes(0 - decrement);
+    // Calculate bytes used before this write operation.
+    // Note that getBytesUsed() already includes the 'bytes' from the current 
write.
+    long bytesUsedBeforeWrite = getBytesUsed() - bytes;

Review Comment:
   Looks like the overwrite factor is not considered here, though I'm not clear 
what's the overwrite usage, but according to the current code, if overwrite is 
true, then bytesUsed will not have bytes added. 



-- 
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: [email protected]

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