[ https://issues.apache.org/jira/browse/MAPREDUCE-5865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14133578#comment-14133578 ]
Rahul Palamuttam commented on MAPREDUCE-5865: --------------------------------------------- Okay I see now why we need the finally block - in case one of the functions in the try block throws an error before the close() function is run. I will make changes #1 and #2 mentioned in my earlier post. Any feedback is helpful - I'm still a little new. > RecordReader is not closed in TeraInputFormat#writePartitionFile() > ------------------------------------------------------------------ > > Key: MAPREDUCE-5865 > URL: https://issues.apache.org/jira/browse/MAPREDUCE-5865 > Project: Hadoop Map/Reduce > Issue Type: Bug > Components: mrv1 > Reporter: Ted Yu > Attachments: MAPREDUCE-5865.patch > > > Here is related code: > {code} > RecordReader<Text, Text> reader = > inFormat.createRecordReader(splits.get(sampleStep * idx), > context); > reader.initialize(splits.get(sampleStep * idx), context); > while (reader.nextKeyValue()) { > sampler.addKey(new Text(reader.getCurrentKey())); > records += 1; > if (recordsPerSample <= records) { > break; > } > } > {code} > reader should be closed using finally block. -- This message was sent by Atlassian JIRA (v6.3.4#6332)