[ 
https://issues.apache.org/jira/browse/HDFS-7596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14272144#comment-14272144
 ] 

Lars Francke commented on HDFS-7596:
------------------------------------

Thanks for taking care of this.

I only have a few minor nitpicks mostly about code style:

{code}
    HashMap<String, DatanodeStorageInfo> excessStorages;

    synchronized (storageMap) {
      // Init excessStorages with all known storages.
      excessStorages = new HashMap<String, DatanodeStorageInfo>(storageMap);

      // Remove storages that the DN reported in the heartbeat.
      for (final StorageReport report : reports) {
        final String storageId = report.getStorage().getStorageID();
        if (excessStorages.get(storageId) != null) {
          excessStorages.remove(storageId);
        }
      }
{code}

can be simplified to

{code}
    synchronized (storageMap) {
      // Init excessStorages with all known storages.
      Map<String, DatanodeStorageInfo> excessStorages = new 
HashMap<>(storageMap);

      // Remove storages that the DN reported in the heartbeat.
      for (final StorageReport report : reports) {
        excessStorages.remove(report.getStorage().getStorageID());
      }
{code}


> NameNode should prune dead storages from storageMap
> ---------------------------------------------------
>
>                 Key: HDFS-7596
>                 URL: https://issues.apache.org/jira/browse/HDFS-7596
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.6.0
>            Reporter: Arpit Agarwal
>            Assignee: Arpit Agarwal
>         Attachments: HDFS-7596.01.patch
>
>
> The NameNode must be able to prune storages that are no longer reported by 
> the DataNode and that have no blocks associated. These stale storages can 
> skew the balancer behavior.
> Detailed discussion on HDFS-7575.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to