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

Xiao Chen commented on HDFS-9250:
---------------------------------

Hey [~andrew.wang],

Thanks again for bringing up HDFS-8646, which looks complete to me. The version 
I encountered the {{ArrayStoreException}} is before your fix. Thus I think it's 
possible that the location is added without disk replica.

Patch 002 is attached. Your suggestion of adding a precondition check sounds 
great, since otherwise we know it's gonna throw the {{ArrayStoreException}} for 
sure in that condition. I left the test case untouched just to run into the 
precondition block. Please review. Thanks!

> LocatedBlock#addCachedLoc may throw ArrayStoreException when cache is empty
> ---------------------------------------------------------------------------
>
>                 Key: HDFS-9250
>                 URL: https://issues.apache.org/jira/browse/HDFS-9250
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: HDFS
>            Reporter: Xiao Chen
>            Assignee: Xiao Chen
>         Attachments: HDFS-9250.001.patch, HDFS-9250.002.patch
>
>
> We may see the following exception:
> {noformat}
> java.lang.ArrayStoreException
> at java.util.ArrayList.toArray(ArrayList.java:389)
> at 
> org.apache.hadoop.hdfs.protocol.LocatedBlock.addCachedLoc(LocatedBlock.java:205)
> at 
> org.apache.hadoop.hdfs.server.namenode.CacheManager.setCachedLocations(CacheManager.java:907)
> at 
> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsUpdateTimes(FSNamesystem.java:1974)
> at 
> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsInt(FSNamesystem.java:1873)
> {noformat}
> The cause is that in LocatedBlock.java, when {{addCachedLoc}}:
> - Passed in parameter {{loc}}, which is type {{DatanodeDescriptor}}, is added 
> to {{cachedList}}
> - {{cachedList}} was assigned to {{EMPTY_LOCS}}, which is type 
> {{DatanodeInfoWithStorage}}.
> Both {{DatanodeDescriptor}} and {{DatanodeInfoWithStorage}} are subclasses of 
> {{DatanodeInfo}} but do not inherit from each other, resulting in the 
> ArrayStoreException.



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

Reply via email to