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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1102,6 +1118,31 @@ ContainerCommandResponseProto handleWriteChunk(
     return getWriteChunkResponseSuccess(request, blockDataProto);
   }
 
+  /**
+   * Commit space reserved for write to usedSpace when write operation 
succeeds.
+   */
+  private void commitSpaceReservedForWrite(HddsVolume volume, boolean 
spaceReserved, long bytes) {
+    if (spaceReserved) {
+      volume.releaseReservedSpaceForWrite(bytes);
+      volume.incrementUsedSpace(bytes);

Review Comment:
   since release and increment are not atomic, its better to incrementUsedSpace 
first and then release reserved space, if its done as it currently implemented 
if other thread check free space between these 2 calls it could try to use free 
space that already used by this write.



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