You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Hairong Kuang (JIRA)" <ji...@apache.org> on 2010/09/03 01:04:34 UTC

[jira] Created: (HDFS-1368) Add a block counter to DatanodeDescriptor

Add a block counter to DatanodeDescriptor
-----------------------------------------

                 Key: HDFS-1368
                 URL: https://issues.apache.org/jira/browse/HDFS-1368
             Project: Hadoop HDFS
          Issue Type: Improvement
          Components: name-node
            Reporter: Hairong Kuang
            Assignee: Hairong Kuang
             Fix For: 0.22.0


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.

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


[jira] Commented: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12906314#action_12906314 ] 

dhruba borthakur commented on HDFS-1368:
----------------------------------------

+1 , looks like a simple optimization to me.

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Commented: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Hairong Kuang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915575#action_12915575 ] 

Hairong Kuang commented on HDFS-1368:
-------------------------------------

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

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Commented: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Hairong Kuang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915923#action_12915923 ] 

Hairong Kuang commented on HDFS-1368:
-------------------------------------

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

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Commented: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Suresh Srinivas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915915#action_12915915 ] 

Suresh Srinivas commented on HDFS-1368:
---------------------------------------

The patch in this jira changed DatanodeDescriptor#numBlock() as:
{noformat}
-    return blockList == null ? 0 : blockList.listCount(this);
+    return numBlocks;
{noformat}

so I did mean BlockInfo#listCount(DatanodeDescriptor).

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Commented: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Hairong Kuang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915937#action_12915937 ] 

Hairong Kuang commented on HDFS-1368:
-------------------------------------

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

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Commented: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909601#action_12909601 ] 

Hadoop QA commented on HDFS-1368:
---------------------------------

-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.

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Updated: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Hairong Kuang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hairong Kuang updated HDFS-1368:
--------------------------------

          Status: Patch Available  (was: Open)
    Hadoop Flags: [Reviewed]

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Commented: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Suresh Srinivas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915430#action_12915430 ] 

Suresh Srinivas commented on HDFS-1368:
---------------------------------------

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

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Commented: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12918157#action_12918157 ] 

Hudson commented on HDFS-1368:
------------------------------

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

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Updated: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Hairong Kuang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hairong Kuang updated HDFS-1368:
--------------------------------

        Status: Resolved  (was: Patch Available)
    Resolution: Fixed

The failed tests are not caused by this patch.

I've committed this!

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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


[jira] Updated: (HDFS-1368) Add a block counter to DatanodeDescriptor

Posted by "Hairong Kuang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HDFS-1368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hairong Kuang updated HDFS-1368:
--------------------------------

    Attachment: blockCounter.patch

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.

> Add a block counter to DatanodeDescriptor
> -----------------------------------------
>
>                 Key: HDFS-1368
>                 URL: https://issues.apache.org/jira/browse/HDFS-1368
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Hairong Kuang
>            Assignee: Hairong Kuang
>             Fix For: 0.22.0
>
>         Attachments: blockCounter.patch
>
>
> 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.

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