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

Renukaprasad C commented on HDFS-15792:
---------------------------------------

Thanks [~hexiaoqiao],
I applied this patch locally too & tried to compile locally (JDK 8), 
compilation failed with the below error.

[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
[ERROR] 
D:\Hadoop\Code\hadoop_OS\hadoop-hdfs-project\hadoop-hdfs\src\main\java\org\apache\hadoop\hdfs\util\ReferenceCountMap.java:77:
 Undefined reference: java.util.concurrent.ConcurrentHashMap.KeySetView
[ERROR] 
D:\Hadoop\Code\hadoop_OS\hadoop-hdfs-project\hadoop-hdfs\src\main\java\org\apache\hadoop\hdfs\util\ReferenceCountMap.java:77:
 Undefined reference: java.util.concurrent.ConcurrentHashMap.KeySetView 
java.util.concurrent.ConcurrentHashMap.keySet()

This is due to compatibility changes done in JDK 7 & JDK 8. 
ConcurrentHashMap.KeySetView - introduced in JDK-8, but when we compile code 
with javac.version=1.7 we get this problem.

Whereas, if we compile on JDK 7, then we dont get this error. I dont think we 
can go with this approach. This is not even JDK bug, rather its usability issue 
with our environment & scripts. So, dont see any other solution for this except 
putting back hashmap and synchronize the code ourselves. 

Since, this is method is used only for test, there is no harm with the changes 
done. My opinion is to ignore the checkstyle issue and continue with this 
workaround - HDFS-15792-branch-2.10.002.patch.  

We shall discuss if any other suggestion.

> ClasscastException while loading FSImage
> ----------------------------------------
>
>                 Key: HDFS-15792
>                 URL: https://issues.apache.org/jira/browse/HDFS-15792
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: nn
>            Reporter: Renukaprasad C
>            Assignee: Renukaprasad C
>            Priority: Major
>             Fix For: 3.3.1, 3.4.0
>
>         Attachments: HDFS-15792-branch-2.10.001.patch, 
> HDFS-15792-branch-2.10.002.patch, HDFS-15792-branch-2.10.003.patch, 
> HDFS-15792.001.patch, HDFS-15792.002.patch, HDFS-15792.003.patch, 
> HDFS-15792.004.patch, HDFS-15792.005.patch, HDFS-15792.addendum.001.patch, 
> image-2021-01-27-12-00-34-846.png
>
>
> FSImage loading has failed with ClasscastException - 
> java.lang.ClassCastException: java.util.HashMap$Node cannot be cast to 
> java.util.HashMap$TreeNode.
> This is the usage issue with Hashmap in concurrent scenarios.
> Same issue has been reported on Java & closed as usage issue.  - 
> https://bugs.openjdk.java.net/browse/JDK-8173671
> 2020-12-28 11:36:26,127 | ERROR | main | An exception occurred when loading 
> INODE from fsiamge. | FSImageFormatProtobuf.java:442
> java.lang.
> : java.util.HashMap$Node cannot be cast to java.util.HashMap$TreeNode
>       at java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1835)
>       at java.util.HashMap$TreeNode.treeify(HashMap.java:1951)
>       at java.util.HashMap.treeifyBin(HashMap.java:772)
>       at java.util.HashMap.putVal(HashMap.java:644)
>       at java.util.HashMap.put(HashMap.java:612)
>       at 
> org.apache.hadoop.hdfs.util.ReferenceCountMap.put(ReferenceCountMap.java:53)
>       at 
> org.apache.hadoop.hdfs.server.namenode.AclStorage.addAclFeature(AclStorage.java:391)
>       at 
> org.apache.hadoop.hdfs.server.namenode.INodeWithAdditionalFields.addAclFeature(INodeWithAdditionalFields.java:349)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode$Loader.loadINodeDirectory(FSImageFormatPBINode.java:225)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode$Loader.loadINode(FSImageFormatPBINode.java:406)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode$Loader.readPBINodes(FSImageFormatPBINode.java:367)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode$Loader.loadINodeSection(FSImageFormatPBINode.java:342)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatProtobuf$Loader$2.call(FSImageFormatProtobuf.java:469)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:748)
> 2020-12-28 11:36:26,130 | ERROR | main | Failed to load image from 
> FSImageFile(file=/srv/BigData/namenode/current/fsimage_0000000000198227480, 
> cpktTxId=0000000000198227480) | FSImage.java:738
> java.io.IOException: java.lang.ClassCastException: java.util.HashMap$Node 
> cannot be cast to java.util.HashMap$TreeNode
>       at 
> org.apache.hadoop.io.MultipleIOException$Builder.add(MultipleIOException.java:68)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatProtobuf$Loader.runLoaderTasks(FSImageFormatProtobuf.java:444)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatProtobuf$Loader.loadInternal(FSImageFormatProtobuf.java:360)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatProtobuf$Loader.load(FSImageFormatProtobuf.java:263)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormat$LoaderDelegator.load(FSImageFormat.java:227)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:971)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:955)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImageFile(FSImage.java:820)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:733)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:331)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1113)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:730)
>       at 
> org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:648)
>       at 
> org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:710)
>       at 
> org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:953)
>       at 
> org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:926)
>       at 
> org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1665)
>       at 
> org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1735)
> Caused by: java.lang.ClassCastException: java.util.HashMap$Node cannot be 
> cast to java.util.HashMap$TreeNode
>       at java.util.HashMap$TreeNode.moveRootToFront(HashMap.java:1835)
>       at java.util.HashMap$TreeNode.treeify(HashMap.java:1951)
>       at java.util.HashMap.treeifyBin(HashMap.java:772)
>       at java.util.HashMap.putVal(HashMap.java:644)
>       at java.util.HashMap.put(HashMap.java:612)
>       at 
> org.apache.hadoop.hdfs.util.ReferenceCountMap.put(ReferenceCountMap.java:53)
>       at 
> org.apache.hadoop.hdfs.server.namenode.AclStorage.addAclFeature(AclStorage.java:391)
>       at 
> org.apache.hadoop.hdfs.server.namenode.INodeWithAdditionalFields.addAclFeature(INodeWithAdditionalFields.java:349)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode$Loader.loadINodeDirectory(FSImageFormatPBINode.java:225)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode$Loader.loadINode(FSImageFormatPBINode.java:406)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode$Loader.readPBINodes(FSImageFormatPBINode.java:367)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode$Loader.loadINodeSection(FSImageFormatPBINode.java:342)
>       at 
> org.apache.hadoop.hdfs.server.namenode.FSImageFormatProtobuf$Loader$2.call(FSImageFormatProtobuf.java:469)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:748)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to