sumitagrawl commented on code in PR #8642:
URL: https://github.com/apache/ozone/pull/8642#discussion_r2157047443


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/HddsDispatcher.java:
##########
@@ -612,6 +617,25 @@ private void sendCloseContainerActionIfNeeded(Container 
container) {
     }
   }
 
+  private void validateVolumeFullForWrite(
+      Container container, Type cmdType, boolean isVolumeFullForWrite) throws 
StorageContainerException {
+    if (!isVolumeFullForWrite) {
+      return;
+    }
+
+    HddsVolume volume = container.getContainerData().getVolume();
+    SpaceUsageSource currentUsage = volume.getCurrentUsage();
+    LOG.warn("Volume [{}] is full. containerID: {}. Volume usage: [{}]. 
Minimum required free space: {}", volume,
+        container.getContainerData().getContainerID(), currentUsage,
+        volume.getFreeSpaceToSpare(currentUsage.getCapacity()));
+    if (cmdType == Type.WriteChunk || cmdType == Type.PutBlock || cmdType == 
Type.PutSmallFile) {
+      // If the volume is full, we should not allow more writes.
+      throw new StorageContainerException("Container write failed due to 
volume " + volume.getStorageID()
+          + " out of space " + currentUsage + " with minimum free space 
required: "
+          + volume.getFreeSpaceToSpare(currentUsage.getCapacity()), 
DISK_OUT_OF_SPACE);

Review Comment:
   @adoroszlai refactored code, and both PR is having same method 
`ContainerUtils.assertSpaceAvailability`. will resolve conflict once one of PR 
is merged.



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