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


##########
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:
   Please, for consistency (of "is full" check, log message and exception 
message) and to avoid duplication:
   
   - use the method being added in #8644
   - move the warning log inside that method
   - remove `isVolumeFullForWrite` as a parameter here, let the method check 
itself



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