From ddae78b0ec7e231b0931133c55fe560ea8aee965 Mon Sep 17 00:00:00 2001 From: hfutatzhanghb Date: Thu, 8 Jun 2023 16:58:01 +0800 Subject: [PATCH] HDFS-17035. FsVolumeImpl#getActualNonDfsUsed may return negative value. (#5708). Contributed by farmmamba. Reviewed-by: Shuyan Zhang Reviewed-by: He Xiaoqiao Signed-off-by: Ayush Saxena --- .../hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java index 9ee73377554..bf68f96a6da 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java @@ -499,7 +499,7 @@ public class FsVolumeImpl implements FsVolumeSpi { return used; } } - return getDfUsed() - getDfsUsed(); + return Math.max(getDfUsed() - getDfsUsed(), 0L); } /**