Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-1368

Add a block counter to DatanodeDescriptor

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.22.0
    • Component/s: namenode
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Many of time, we need to count the total number of blocks in a datanode by calling DatanodeDescriptor#numBlocks(). It has to traverse the block list to get the counter, which may not be trivial if there are millions of blocks. Adding a counter for each datanode does not cost much space but help save CPU processing time.

        Activity

        Hide
        Hairong Kuang added a comment -

        This is a simple patch that adds a block counter to DatanodeDescriptor. It adds a test case that check if the counter is set corrently.

        Show
        Hairong Kuang added a comment - This is a simple patch that adds a block counter to DatanodeDescriptor. It adds a test case that check if the counter is set corrently.
        Hide
        dhruba borthakur added a comment -

        +1 , looks like a simple optimization to me.

        Show
        dhruba borthakur added a comment - +1 , looks like a simple optimization to me.
        Hide
        Hadoop QA added a comment -

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

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

        +1 tests included. The patch appears to include 3 new or modified tests.

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

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

        +1 findbugs. The patch does not introduce any new Findbugs warnings.

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

        -1 core tests. The patch failed core unit tests.

        -1 contrib tests. The patch failed contrib unit tests.

        +1 system tests framework. The patch passed system tests framework compile.

        Test results: http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/458/testReport/
        Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/458/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/458/artifact/trunk/build/test/checkstyle-errors.html
        Console output: http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/458/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/12453836/blockCounter.patch against trunk revision 997157. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 3 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. -1 core tests. The patch failed core unit tests. -1 contrib tests. The patch failed contrib unit tests. +1 system tests framework. The patch passed system tests framework compile. Test results: http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/458/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/458/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/458/artifact/trunk/build/test/checkstyle-errors.html Console output: http://hudson.zones.apache.org/hudson/job/Hdfs-Patch-h5.grid.sp2.yahoo.net/458/console This message is automatically generated.
        Hide
        Hairong Kuang added a comment -

        The failed tests are not caused by this patch.

        I've committed this!

        Show
        Hairong Kuang added a comment - The failed tests are not caused by this patch. I've committed this!
        Hide
        Suresh Srinivas added a comment -

        Hairong, is it a good idea to remove BlockInfo#listCount(DatanodeDescriptor ..) or change it to call DatanodeDescriptor#numBlocks()?

        Show
        Suresh Srinivas added a comment - Hairong, is it a good idea to remove BlockInfo#listCount(DatanodeDescriptor ..) or change it to call DatanodeDescriptor#numBlocks()?
        Hide
        Hairong Kuang added a comment -

        Suresh, you meant BlocksMap#listCount, right? Yeah, we probably should remove it since it is not used anywhere else.

        Show
        Hairong Kuang added a comment - Suresh, you meant BlocksMap#listCount, right? Yeah, we probably should remove it since it is not used anywhere else.
        Hide
        Suresh Srinivas added a comment -

        The patch in this jira changed DatanodeDescriptor#numBlock() as:

        -    return blockList == null ? 0 : blockList.listCount(this);
        +    return numBlocks;
        

        so I did mean BlockInfo#listCount(DatanodeDescriptor).

        Show
        Suresh Srinivas added a comment - The patch in this jira changed DatanodeDescriptor#numBlock() as: - return blockList == null ? 0 : blockList.listCount(this); + return numBlocks; so I did mean BlockInfo#listCount(DatanodeDescriptor).
        Hide
        Hairong Kuang added a comment -

        Yes, you are right. It's BlockInfo defined in BlocksMap. I will create a patch to remove this method.

        Show
        Hairong Kuang added a comment - Yes, you are right. It's BlockInfo defined in BlocksMap. I will create a patch to remove this method.
        Hide
        Hairong Kuang added a comment -

        Suresh, I created HDFS-1426 to address your comment. Could you please review it? Thanks.

        Show
        Hairong Kuang added a comment - Suresh, I created HDFS-1426 to address your comment. Could you please review it? Thanks.
        Hide
        Hudson added a comment -

        Integrated in Hadoop-Hdfs-trunk-Commit #406 (See https://hudson.apache.org/hudson/job/Hadoop-Hdfs-trunk-Commit/406/)

        Show
        Hudson added a comment - Integrated in Hadoop-Hdfs-trunk-Commit #406 (See https://hudson.apache.org/hudson/job/Hadoop-Hdfs-trunk-Commit/406/ )

          People

          • Assignee:
            Hairong Kuang
            Reporter:
            Hairong Kuang
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development