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

Hairong Kuang commented on HDFS-812:
------------------------------------

In case of 0 block, the original code seems to handle correctly. The NPE is 
thrown in finalizeINodeFileUnderConstruction:
java.lang.NullPointerException
        at java.util.TreeMap.getEntry(TreeMap.java:324)
        at java.util.TreeMap.get(TreeMap.java:255)
        at 
org.apache.hadoop.hdfs.server.namenode.LeaseManager.getLease(LeaseManager.java:82)
        at 
org.apache.hadoop.hdfs.server.namenode.LeaseManager.removeLease(LeaseManager.java:140)
        at 
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.finalizeINodeFileUnderConstruction(FSNamesystem.java:2037)
        at 
org.apache.hadoop.hdfs.server.namenode.FSNamesystem.internalReleaseLease(FSNamesystem.java:1939)
        at 
org.apache.hadoop.hdfs.server.namenode.TestNNLeaseRecovery.testInternalReleaseLease_0blocks(TestNNLeaseRecovery.java:179)
Is it a test set up problem?

> FSNamesystem#internalReleaseLease throws ArrayIndexOutOfBoundException or 
> NullPointerException on an empty and single-block file's lease recovery
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-812
>                 URL: https://issues.apache.org/jira/browse/HDFS-812
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: name-node
>    Affects Versions: 0.21.0, 0.22.0
>            Reporter: Konstantin Boudnik
>         Attachments: HDFS-812.patch, HDFS-812.patch, HDFS-812.patch, 
> HDFS-812.patch
>
>
> {{FSNamesystem.internalReleaseLease()}} uses the result of 
> {{iFile#numBlocks();}} call to get a number of an under construction file's 
> blocks. {{numBlock()}} can return 0 if the file doesn't have any blocks yet. 
> This will cause {{internalReleaseLease()}} to throw 
> ArrayIndexOutOfBoundException.
> In case of a single block file, the same method will throw 
> NullPointerException because the penultimate block is going to be null 
> according to the logic of INodeFile#getPenultimateBlock().

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to