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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1102,6 +1109,19 @@ ContainerCommandResponseProto handleWriteChunk(
     return getWriteChunkResponseSuccess(request, blockDataProto);
   }
 
+  /**
+   * Roll back usedSpace when write operation fails after writeChunk succeeded.
+   */
+  private void rollbackUsedSpaceOnWriteFailure(KeyValueContainer kvContainer, 
boolean writeChunkSucceeded,
+      long bytesWritten) {
+    if (writeChunkSucceeded && bytesWritten > 0) {
+      HddsVolume volume = kvContainer.getContainerData().getVolume();
+      if (volume != null) {
+        volume.decrementUsedSpace(bytesWritten);

Review Comment:
   Can logic to be changed to update volume's used space when data is 
successfully written to the disk. if we want to track space that would be used  
by concurrent writes we can introduce the concept of space reserved for 
in-flight writes and update usedSpace only if write is successful.



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