zaynt4606 commented on code in PR #2688:
URL: https://github.com/apache/celeborn/pull/2688#discussion_r1724361125


##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/StorageManager.scala:
##########
@@ -851,20 +854,33 @@ final private[worker] class StorageManager(conf: 
CelebornConf, workerSource: Abs
           0
         }
       }.sum
-      val fileStore = Files.getFileStore(Paths.get(diskInfo.mountPoint))
-      val fileSystemReportedUsableSpace = fileStore.getUsableSpace
+
+      val lists = getFileSystemReportedSpace(diskInfo.mountPoint)
+      val fileSystemReportedUsableSpace = lists.head
+      val fileSystemReportedTotalSpace = lists(1)
       val workingDirUsableSpace =
         Math.min(diskInfo.configuredUsableSpace - totalUsage, 
fileSystemReportedUsableSpace)
-      val totalSpace = fileStore.getTotalSpace
-      logDebug(s"updateDiskInfos workingDirUsableSpace:$workingDirUsableSpace 
filemeta:$fileSystemReportedUsableSpace conf:${diskInfo.configuredUsableSpace} 
totalUsage:$totalUsage totalSpace: $totalSpace")
-      diskInfo.setUsableSpace(workingDirUsableSpace)
-      diskInfo.setTotalSpace(totalSpace)
+      val minimumReserveSize =
+        DiskUtils.getMinimumUsableSize(diskInfo, diskReserveSize, 
diskReserveRatio)
+      val usableSpace = Math.max(workingDirUsableSpace - minimumReserveSize, 0)
+      logDebug(s"updateDiskInfos workingDirUsableSpace:$workingDirUsableSpace 
filemeta:$fileSystemReportedUsableSpace" +
+        s"conf:${diskInfo.configuredUsableSpace} totalUsage:$totalUsage 
totalSpace:$fileSystemReportedTotalSpace" +
+        s"minimumReserveSize:$minimumReserveSize usableSpace:$usableSpace")
+      diskInfo.setUsableSpace(usableSpace)
+      diskInfo.setTotalSpace(fileSystemReportedTotalSpace)
       diskInfo.updateFlushTime()
       diskInfo.updateFetchTime()
     }
     logInfo(s"Updated diskInfos:\n${disksSnapshot().mkString("\n")}")
   }
 
+  def getFileSystemReportedSpace(mountPoint: String): List[Long] = {
+    val fileStore = Files.getFileStore(Paths.get(mountPoint))
+    val fileSystemReportedUsableSpace = fileStore.getUsableSpace
+    val fileSystemReportedTotalSpace = fileStore.getTotalSpace
+    List(fileSystemReportedUsableSpace, fileSystemReportedTotalSpace)
+  }

Review Comment:
   Done~



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

Reply via email to