yanbin.zhang created HDFS-16450:
-----------------------------------

             Summary: Give priority to releasing DNs with less free space
                 Key: HDFS-16450
                 URL: https://issues.apache.org/jira/browse/HDFS-16450
             Project: Hadoop HDFS
          Issue Type: Improvement
          Components: hdfs
    Affects Versions: 3.3.0
            Reporter: yanbin.zhang
            Assignee: yanbin.zhang


When deleting redundant replicas, the one with the least free space should be 
prioritized.
{code:java}
//BlockPlacementPolicyDefault#chooseReplicaToDelete

final DatanodeStorageInfo storage;
if (oldestHeartbeatStorage != null) {
  storage = oldestHeartbeatStorage;
} else if (minSpaceStorage != null) {
  storage = minSpaceStorage;
} else {
  return null;
}
excessTypes.remove(storage.getStorageType());
return storage; {code}
Change the above logic to the following:
{code:java}
//BlockPlacementPolicyDefault#chooseReplicaToDelete
final DatanodeStorageInfo storage;
if (minSpaceStorage != null) {
  storage = minSpaceStorage;
} else if (oldestHeartbeatStorage != null) {
  storage = oldestHeartbeatStorage;
} else {
  return null;
} {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to