[ 
https://issues.apache.org/jira/browse/HADOOP-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605315#action_12605315
 ] 

Aaron Greenhouse commented on HADOOP-3554:
------------------------------------------

Okay.  After reevaluating in the SVN Trunk (rather than based on the 0.17.0 
source code), the field maxLineLength also needs to be made final.

So, in summary
* If objects of the class LineRecordReader really are used by multiple threads, 
then the class needs to be updated:
  - Make the fields start, end, and maxLineLength final.
  - Make the method getProgress() synchronized.
* Otherwise, remove the existing synchronization from methods next(), getPos(), 
and close() and update the class documentation to indicate that instances are 
not thread safe.


> LineRecordReader needs more synchronization
> -------------------------------------------
>
>                 Key: HADOOP-3554
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3554
>             Project: Hadoop Core
>          Issue Type: Bug
>    Affects Versions: 0.17.0
>         Environment: All java platforms
>            Reporter: Aaron Greenhouse
>         Attachments: LineRecordReader.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> LineRecordReader has three index fields start, end, and pos.  All of these 
> fields are long, which means that, in general, access to them is not atomic.  
> This can cause problems if the fields are accessed without appropriate 
> synchronization.  
> I propose the following changes to the class:
> - Make the fields start and end final.  This requires some minor changes to 
> the constructor LineRecordReader(Configuration, FileSplit).
> - Make the method getProgress() synchronized.

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

Reply via email to