You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/05/17 12:34:51 UTC

[GitHub] [ozone] ChenSammi commented on a change in pull request #2246: HDDS-5209. Datanode hasEnoughSpace check should apply on volume instead of global DN

ChenSammi commented on a change in pull request #2246:
URL: https://github.com/apache/ozone/pull/2246#discussion_r633490167



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/SCMCommonPlacementPolicy.java
##########
@@ -165,9 +166,15 @@ public ConfigurationSource getConf() {
    */
   public boolean hasEnoughSpace(DatanodeDetails datanodeDetails,
       long sizeRequired) {
-    SCMNodeMetric nodeMetric = nodeManager.getNodeStat(datanodeDetails);
-    return (nodeMetric != null) && (nodeMetric.get() != null)
-        && nodeMetric.get().getRemaining().hasResources(sizeRequired);
+    if (datanodeDetails instanceof DatanodeInfo) {
+      DatanodeInfo datanodeInfo = (DatanodeInfo) datanodeDetails;
+      for (StorageReportProto reportProto : datanodeInfo.getStorageReports()) {
+        if (reportProto.getRemaining() > sizeRequired) {
+          return true;
+        }
+      }
+    }
+    return false;

Review comment:
       I think we need to distinguish two "false" cases here, one is datanodeDetails is not a DatanodeInfo, another is this DN doesn't have enough space.  The latter case is normal, but the formal case indidates that current solution is not perfect.  It would be better if there is a WARN or INFO log so that we can find the issue quickly. 




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

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



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