Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-5761

DataNode fails to validate integrity for checksum type NULL when DataNode recovers

    Details

    • Type: Bug Bug
    • Status: Patch Available
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: datanode
    • Labels:
      None

      Description

      When DataNode is down during writing blocks, the blocks are not filinalized and the next time DataNode recovers, integrity validation will run.
      But if we use NULL for checksum algorithm (we can set NULL to dfs.checksum.type), DataNode will fail to validate integrity and cannot be up.

      The cause is in BlockPoolSlice#validateIntegrity.
      In the method, there is following code.

      long numChunks = Math.min(
                (blockFileLen + bytesPerChecksum - 1)/bytesPerChecksum, 
                (metaFileLen - crcHeaderLen)/checksumSize);
      

      When we choose NULL checksum, checksumSize is 0 so ArithmeticException will be thrown and DataNode cannot be up.

      1. HDFS-5761.patch
        1 kB
        Kousuke Saruta

        Activity

        Hide
        Kousuke Saruta added a comment -

        Thanks for your comment, Uma.
        At first, I thought same as you.
        I thought it's good to branch the logic depending on whether checksum type is NULL or not.
        But, on second thought, BlockPoolSlice should not have logic which depends specific checksum algorithm.
        How to verify is responsibility of each checksum algorithm.

        Show
        Kousuke Saruta added a comment - Thanks for your comment, Uma. At first, I thought same as you. I thought it's good to branch the logic depending on whether checksum type is NULL or not. But, on second thought, BlockPoolSlice should not have logic which depends specific checksum algorithm. How to verify is responsibility of each checksum algorithm.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12622648/HDFS-5761.patch
        against trunk revision .

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed unit tests in hadoop-hdfs-project/hadoop-hdfs.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/5865//testReport/
        Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/5865//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12622648/HDFS-5761.patch against trunk revision . +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 javadoc . The javadoc tool did not generate any warning messages. +1 eclipse:eclipse . The patch built with eclipse:eclipse. +1 findbugs . The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. +1 core tests . The patch passed unit tests in hadoop-hdfs-project/hadoop-hdfs. +1 contrib tests . The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/5865//testReport/ Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/5865//console This message is automatically generated.
        Hide
        Uma Maheswara Rao G added a comment -

        Thanks for filing a JIRA. I noticed this when I was looking the JIRA HDFS-5728.
        Actually validate integrity check not necessary when it is set to NULL. It should consider full file length as is.
        I think the below array becomes 0 length array when checksumSize 0?

        byte[] buf = new byte[lastChunkSize+checksumSize];
        

        So, how about just considering blockFileLength when crc type is NULL? Because crc is null now, so we need not care about integrity check with CRC file at all right.

        Show
        Uma Maheswara Rao G added a comment - Thanks for filing a JIRA. I noticed this when I was looking the JIRA HDFS-5728 . Actually validate integrity check not necessary when it is set to NULL. It should consider full file length as is. I think the below array becomes 0 length array when checksumSize 0? byte [] buf = new byte [lastChunkSize+checksumSize]; So, how about just considering blockFileLength when crc type is NULL? Because crc is null now, so we need not care about integrity check with CRC file at all right.
        Hide
        Kousuke Saruta added a comment -

        I've attached a patch for this issue.

        Show
        Kousuke Saruta added a comment - I've attached a patch for this issue.

          People

          • Assignee:
            Kousuke Saruta
            Reporter:
            Kousuke Saruta
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:

              Development