Issue Details (XML | Word | Printable)

Key: HADOOP-2148
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Konstantin Shvachko
Reporter: Konstantin Shvachko
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

Inefficient FSDataset.getBlockFile()

Created: 03/Nov/07 12:12 AM   Updated: 08/Jul/09 04:42 PM
Return to search
Component/s: None
Affects Version/s: 0.14.0
Fix Version/s: 0.17.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works getBlockFile.patch 2008-03-15 02:13 AM Konstantin Shvachko 2 kB
Text File Licensed for inclusion in ASF works getBlockFile1.patch 2008-03-18 01:29 AM Konstantin Shvachko 4 kB

Resolution Date: 19/Mar/08 10:48 PM


 Description  « Hide
FSDataset.getBlockFile() first verifies that the block is valid and then returns the file name corresponding to the block.
Doing that it performs the data-node blockMap lookup twice. Only one lookup is needed here.
This is important since the data-node blockMap is big.

Another observation is that data-nodes do not need the blockMap at all. File names can be derived from the block IDs,
there is no need to hold Block to File mapping in memory.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Raghu Angadi added a comment - 03/Nov/07 12:36 AM
> Another observation is that data-nodes do not need the blockMap at all. File names can be derived from the block IDs,
there is no need to hold Block to File mapping in memory.

It has the full path like "dir/subdir2/subdir63/ ....". Also existence of block to File mapping indicates that file is still valid.

currently getBlockFile() is expected to throw IOException when there is no mapping. yes, removing double look up would be good.


Konstantin Shvachko added a comment - 03/Nov/07 01:17 AM
Yes I understand that the blockMap is there right now because of the subdirs and the volumes, but
it would be better to have file names computable. This should probably belong to a different issue though.

Konstantin Shvachko added a comment - 15/Mar/08 02:13 AM
This patch optimizes FSDataset.getBlockFile() and FSDataset.getLength() so that they perform the data-node
blockMap lookup only once. The patch is pretty straightforward. I don't think we should benchmark this.

Hadoop QA added a comment - 15/Mar/08 09:52 PM
-1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12377962/getBlockFile.patch
against trunk revision 619744.

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

tests included -1. The patch doesn't appear to include any new or modified tests.
Please justify why no tests are needed for this patch.

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

javac +1. The applied patch does not generate any new javac compiler warnings.

release audit +1. The applied patch does not generate any new release audit warnings.

findbugs -1. The patch appears to introduce 1 new Findbugs warnings.

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

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

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1976/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1976/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1976/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1976/console

This message is automatically generated.


Konstantin Shvachko added a comment - 18/Mar/08 01:29 AM
This fixes findBugs warnings.
I could not reproduce test timeout in TestDFSStorageStateRecovery.
This test has a lot of test cases. My suspicion is that if Hudson runs slow it could run out of time on this.

Hadoop QA added a comment - 18/Mar/08 08:17 PM
-1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12378094/getBlockFile1.patch
against trunk revision 619744.

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

tests included -1. The patch doesn't appear to include any new or modified tests.
Please justify why no tests are needed for this patch.

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

javac +1. The applied patch does not generate any new javac compiler warnings.

release audit +1. The applied patch does not generate any new release audit warnings.

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

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

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

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1987/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1987/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1987/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1987/console

This message is automatically generated.


Hairong Kuang added a comment - 18/Mar/08 11:15 PM
+1 This patch looks good. It removes a duplicate block map look up.

Konstantin Shvachko added a comment - 19/Mar/08 08:07 PM
I verified both test failures. They are not related to the patch imo.
In the first case TestDFSStorageStateRecovery took too long. It finished only 47 cases out of 71 in 13 minutes when the junit framework terminated it.
In the second case the cluster fell into a infinite loop trying to replicate a block. Filed HADOOP-3050 to investigate it.

Konstantin Shvachko added a comment - 19/Mar/08 10:48 PM
I just committed this.

Hudson added a comment - 20/Mar/08 01:13 PM