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

Erik Krogen commented on HDFS-12818:
------------------------------------

Thanks for looking [~shv]!

{{getStorage()}} can never return null:
{code}
  private SimulatedStorage getStorage(Block b) {
    return storages.get(LongMath.mod(b.getBlockId(), storages.size()));
  }
{code}
This will always return one of the values contained within {{storages}} which 
does not contain any null values.

{{getBlockMap(b, bpid)}} also cannot return null; it simply passes through to 
{{SimulatedStorage#getBlockMap(bpid)}}:
{code}
    Map<Block, BInfo> getBlockMap(String bpid) throws IOException {
      SimulatedBPStorage bpStorage = map.get(bpid);
      if (bpStorage == null) {
        throw new IOException("Nonexistent block pool: " + bpid);
      }
      return bpStorage.getBlockMap();
    }
{code}
{{SimulatedBPStorage#getBlockMap()}} returns a {{final}} non-null field so we 
are good to go throughout.

I updated the Javadoc comments to make this more clear; attaching v002 patch. I 
believe the 1 new checkstyle issue is a long import from a static import in the 
test; nothing I can do hence why I did not fix it between v000 and v001.

> Support multiple storages in DataNodeCluster / SimulatedFSDataset
> -----------------------------------------------------------------
>
>                 Key: HDFS-12818
>                 URL: https://issues.apache.org/jira/browse/HDFS-12818
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode, test
>            Reporter: Erik Krogen
>            Assignee: Erik Krogen
>            Priority: Minor
>         Attachments: HDFS-12818.000.patch, HDFS-12818.001.patch, 
> HDFS-12818.002.patch
>
>
> Currently {{SimulatedFSDataset}} (and thus, {{DataNodeCluster}} with 
> {{-simulated}}) only supports a single storage per {{DataNode}}. Given that 
> the number of storages can have important implications on the performance of 
> block report processing, it would be useful for these classes to support a 
> multiple storage configuration.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to