sumitagrawl commented on code in PR #8642:
URL: https://github.com/apache/ozone/pull/8642#discussion_r2154965763
##########
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:
We need isFullVolume flag for sendCloseContainerActionIfNeeded(), so it will
be checked twice if use that method. Additionally this is handled for few set
of request for throw exception.
Considering this, it may not be possible to use common method here. Since
write path needs to be fast, so avoiding getting the spaceusages multiple time.
@adoroszlai I think we may not need change considering above cases.
--
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]