You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "zhangshuyan0 (via GitHub)" <gi...@apache.org> on 2023/06/05 12:05:49 UTC

[GitHub] [hadoop] zhangshuyan0 commented on a diff in pull request #5715: HDFS-17037. Consider nonDfsUsed when running balancer.

zhangshuyan0 commented on code in PR #5715:
URL: https://github.com/apache/hadoop/pull/5715#discussion_r1217976452


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/BalancingPolicy.java:
##########
@@ -104,21 +104,21 @@ void accumulateSpaces(DatanodeStorageReport r) {
       for(StorageReport s : r.getStorageReports()) {
         final StorageType t = s.getStorage().getStorageType();
         totalCapacities.add(t, s.getCapacity());
-        totalUsedSpaces.add(t, s.getDfsUsed());
+        totalUsedSpaces.add(t, (s.getCapacity() - s.getRemaining()));

Review Comment:
   Thanks for your suggestion. I checked that `FsVolumeImpl#configuredCapacity` is set only by `FsVolumeImpl#setCapacityForTesting`, and `FsVolumeImpl#setCapacityForTesting` is used for unit tests. So  `s.getCapacity() - s.getRemaining()` will never be negative.



-- 
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: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org