sarvekshayr commented on code in PR #9655:
URL: https://github.com/apache/ozone/pull/9655#discussion_r2993548647


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerData.java:
##########
@@ -672,6 +674,14 @@ public synchronized void updateWrite(long length, boolean 
overwrite) {
       writeBytes += length;
     }
 
+    /**
+     * Increment blockBytes by the given delta.
+     * This is used for overwrite operations that extend the file.
+     */
+    public synchronized void incrementBlockBytes(long delta) {
+      blockBytes += delta;

Review Comment:
   `writeCount` and `writeBytes` were being incremented twice when 
overwrite=true.
   Once updateWrite() would increment and then again in updateWriteStats().
   ```
       if (overwrite) {
         long fileLengthAfterWrite = offset + chunkLength;
         if (fileLengthAfterWrite > fileLengthBeforeWrite) {
           containerData.getStatistics().updateWrite(fileLengthAfterWrite - 
fileLengthBeforeWrite, false);
         }
       }
   
       containerData.updateWriteStats(chunkLength, overwrite);
   ```



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