You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Hong Tang (JIRA)" <ji...@apache.org> on 2009/08/07 06:11:14 UTC
[jira] Created: (HADOOP-6177) FSInputChecker.getPos() would return
position greater than the file size
FSInputChecker.getPos() would return position greater than the file size
------------------------------------------------------------------------
Key: HADOOP-6177
URL: https://issues.apache.org/jira/browse/HADOOP-6177
Project: Hadoop Common
Issue Type: Bug
Reporter: Hong Tang
When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HADOOP-6177) FSInputChecker.getPos() would return
position greater than the file size
Posted by "Hong Tang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hong Tang updated HADOOP-6177:
------------------------------
Attachment: hadoop-6177-2090806.patch
Patch contains both modified test cases and the one line fix.
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Hong Tang
> Assignee: Hong Tang
> Attachments: hadoop-6177-2090806.patch, hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HADOOP-6177) FSInputChecker.getPos() would
return position greater than the file size
Posted by "Hong Tang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740395#action_12740395 ]
Hong Tang commented on HADOOP-6177:
-----------------------------------
The root cause is because readChecksumChunk returns -1 when the fs input stream reaches the end of the file. And in fill(), this leads to count == -1 (FSInputChecker.java:176). The fix is rather simple, adding the following line at the end of fill():
{noformat}
count = readChecksumChunk(buf, 0, buf.length);
+ if (count < 0) count = 0;
{noformat}
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Hong Tang
> Assignee: Hong Tang
> Attachments: hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HADOOP-6177) FSInputChecker.getPos() would
return position greater than the file size
Posted by "Hudson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742376#action_12742376 ]
Hudson commented on HADOOP-6177:
--------------------------------
Integrated in Hadoop-Common-trunk #52 (See [http://hudson.zones.apache.org/hudson/job/Hadoop-Common-trunk/52/])
. FSInputChecker.getPos() would return position greater than the file size. Contributed by Hong Tang.
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 0.21.0
> Reporter: Hong Tang
> Assignee: Hong Tang
> Fix For: 0.21.0
>
> Attachments: hadoop-6177-2090806.patch, hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HADOOP-6177) FSInputChecker.getPos() would
return position greater than the file size
Posted by "Hairong Kuang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741419#action_12741419 ]
Hairong Kuang commented on HADOOP-6177:
---------------------------------------
Good catch, Hong!
+1 The patch looks good.
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 0.21.0
> Reporter: Hong Tang
> Assignee: Hong Tang
> Fix For: 0.21.0
>
> Attachments: hadoop-6177-2090806.patch, hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HADOOP-6177) FSInputChecker.getPos() would return
position greater than the file size
Posted by "Hairong Kuang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hairong Kuang updated HADOOP-6177:
----------------------------------
Resolution: Fixed
Hadoop Flags: [Reviewed]
Status: Resolved (was: Patch Available)
I just committed this. Thanks Hong!
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 0.21.0
> Reporter: Hong Tang
> Assignee: Hong Tang
> Fix For: 0.21.0
>
> Attachments: hadoop-6177-2090806.patch, hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HADOOP-6177) FSInputChecker.getPos() would return
position greater than the file size
Posted by "Hong Tang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hong Tang updated HADOOP-6177:
------------------------------
Attachment: hadoop-6177-testcase.patch
The patch file modifies existing test cases to check that after reading through the file, the final offset would be the same as the file offset. On my local machine, it yields:
{noformat}
% ant test-core -Dtestcase=TestChecksumFileSystem
run-test-core:
[delete] Deleting directory /Users/htang/Documents/Work/workspace/hadoop-common/build/test/data
[mkdir] Created dir: /Users/htang/Documents/Work/workspace/hadoop-common/build/test/data
[delete] Deleting directory /Users/htang/Documents/Work/workspace/hadoop-common/build/test/logs
[mkdir] Created dir: /Users/htang/Documents/Work/workspace/hadoop-common/build/test/logs
[junit] Running org.apache.hadoop.fs.TestChecksumFileSystem
[junit] Tests run: 2, Failures: 1, Errors: 0, Time elapsed: 0.59 sec
[junit] Test org.apache.hadoop.fs.TestChecksumFileSystem FAILED
% tail build/test/TEST-org.apache.hadoop.fs.TestChecksumFileSystem.txt
------------- ---------------- ---------------
Testcase: testgetChecksumLength took 0.196 sec
Testcase: testVerifyChecksum took 0.373 sec
FAILED
expected:<7> but was:<8>
junit.framework.AssertionFailedError: expected:<7> but was:<8>
at org.apache.hadoop.fs.TestLocalFileSystem.readFile(TestLocalFileSystem.java:45)
at org.apache.hadoop.fs.TestChecksumFileSystem.testVerifyChecksum(TestChecksumFileSystem.java:57)
{noformat}
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Hong Tang
> Attachments: hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (HADOOP-6177) FSInputChecker.getPos() would return
position greater than the file size
Posted by "Hong Tang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hong Tang reassigned HADOOP-6177:
---------------------------------
Assignee: Hong Tang
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Hong Tang
> Assignee: Hong Tang
> Attachments: hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (HADOOP-6177) FSInputChecker.getPos() would
return position greater than the file size
Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740412#action_12740412 ]
Hadoop QA commented on HADOOP-6177:
-----------------------------------
+1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12415815/hadoop-6177-2090806.patch
against trunk revision 800919.
+1 @author. The patch does not contain any @author tags.
+1 tests included. The patch appears to include 6 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 passed core unit tests.
+1 contrib tests. The patch passed contrib unit tests.
Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/593/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/593/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/593/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/593/console
This message is automatically generated.
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 0.21.0
> Reporter: Hong Tang
> Assignee: Hong Tang
> Fix For: 0.21.0
>
> Attachments: hadoop-6177-2090806.patch, hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (HADOOP-6177) FSInputChecker.getPos() would return
position greater than the file size
Posted by "Hong Tang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-6177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hong Tang updated HADOOP-6177:
------------------------------
Fix Version/s: 0.21.0
Affects Version/s: 0.21.0
Status: Patch Available (was: Open)
ant test and ant test-patch passed on my local machine:
[exec] +1 overall.
[exec]
[exec] +1 @author. The patch does not contain any @author tags.
[exec]
[exec] +1 tests included. The patch appears to include 6 new or modified tests.
[exec]
[exec] +1 javadoc. The javadoc tool did not generate any warning messages.
[exec]
[exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings.
[exec]
[exec] +1 findbugs. The patch does not introduce any new Findbugs warnings.
[exec]
[exec] +1 release audit. The applied patch does not increase the total number of release audit warnings.
> FSInputChecker.getPos() would return position greater than the file size
> ------------------------------------------------------------------------
>
> Key: HADOOP-6177
> URL: https://issues.apache.org/jira/browse/HADOOP-6177
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 0.21.0
> Reporter: Hong Tang
> Assignee: Hong Tang
> Fix For: 0.21.0
>
> Attachments: hadoop-6177-2090806.patch, hadoop-6177-testcase.patch
>
>
> When using a small buffer (< 512 bytes) to read through the whole file, the final file position is 1+ the file size.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.