[
https://issues.apache.org/jira/browse/HDFS-7764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15032490#comment-15032490
]
Colin Patrick McCabe commented on HDFS-7764:
--------------------------------------------
Thanks, [~rakeshr].
{code}
856 if (fileNames.size() < 0) {
857 return report;
858 }
{code}
What's the purpose of this if statement? The size of a list can't be less than
0.
{code}
859 files = new File[fileNames.size()];
860 for (int i = 0; i < fileNames.size(); i++) {
861 files[i] = new File(dir, fileNames.get(i));
862 }
863 Arrays.sort(files);
{code}
It would be nice to avoid allocating all these new arrays. We don't really
need them. We should be able to sort the list with {{List#sort}}, and we can
turn the {{String}} objects into {{File}} objects one at a time in the for loop.
> DirectoryScanner shouldn't abort the scan if one directory had an error
> -----------------------------------------------------------------------
>
> Key: HDFS-7764
> URL: https://issues.apache.org/jira/browse/HDFS-7764
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: datanode
> Affects Versions: 2.7.0
> Reporter: Rakesh R
> Assignee: Rakesh R
> Attachments: HDFS-7764-01.patch, HDFS-7764.patch
>
>
> If there is an exception while preparing the ScanInfo for the blocks in the
> directory, DirectoryScanner is immediately throwing exception and coming out
> of the current scan cycle. The idea of this jira is to discuss & improve the
> exception handling mechanism.
> DirectoryScanner.java
> {code}
> for (Entry<Integer, Future<ScanInfoPerBlockPool>> report :
> compilersInProgress.entrySet()) {
> try {
> dirReports[report.getKey()] = report.getValue().get();
> } catch (Exception ex) {
> LOG.error("Error compiling report", ex);
> // Propagate ex to DataBlockScanner to deal with
> throw new RuntimeException(ex);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)