You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pv...@apache.org on 2021/03/29 11:47:09 UTC
[hive] branch branch-3 updated: HIVE-24851: Fix reader leak in
AvroGenericRecordReader (Lukasz Osipiuk reviewed by Peter Vary) (#2104)
This is an automated email from the ASF dual-hosted git repository.
pvary pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/branch-3 by this push:
new 7ad1411 HIVE-24851: Fix reader leak in AvroGenericRecordReader (Lukasz Osipiuk reviewed by Peter Vary) (#2104)
7ad1411 is described below
commit 7ad141148e68775c0c0d0c67fcb0def81b433515
Author: Ćukasz Osipiuk <lu...@osipiuk.net>
AuthorDate: Mon Mar 29 13:46:47 2021 +0200
HIVE-24851: Fix reader leak in AvroGenericRecordReader (Lukasz Osipiuk reviewed by Peter Vary) (#2104)
Closes (#2040)
---
.../hive/ql/io/avro/AvroGenericRecordReader.java | 36 ++++++++++++++++------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/avro/AvroGenericRecordReader.java b/ql/src/java/org/apache/hadoop/hive/ql/io/avro/AvroGenericRecordReader.java
index 485337e..8944eac 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/avro/AvroGenericRecordReader.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/avro/AvroGenericRecordReader.java
@@ -87,20 +87,36 @@ public class AvroGenericRecordReader implements
}
if (split.getLength() == 0) {
- this.isEmptyInput = true;
- this.start = 0;
this.reader = null;
- }
- else {
- this.isEmptyInput = false;
+ this.isEmptyInput = true;
+ } else {
this.reader = new DataFileReader<GenericRecord>(new FsInput(split.getPath(), job), gdr);
- this.reader.sync(split.getStart());
- this.start = reader.tell();
+ this.isEmptyInput = false;
}
- this.stop = split.getStart() + split.getLength();
- this.recordReaderID = new UID();
- this.writerTimezone = extractWriterTimezoneFromMetadata(job, split, gdr);
+ try {
+ if (this.isEmptyInput) {
+ this.start = 0;
+ } else {
+ this.reader.sync(split.getStart());
+ this.start = reader.tell();
+ }
+ this.stop = split.getStart() + split.getLength();
+ this.recordReaderID = new UID();
+
+ this.writerTimezone = extractWriterTimezoneFromMetadata(job, split, gdr);
+ } catch (Exception e) {
+ if (this.reader != null) {
+ try {
+ this.reader.close();
+ } catch (Exception closeException) {
+ if (closeException != e) {
+ e.addSuppressed(closeException);
+ }
+ }
+ }
+ throw e;
+ }
}
/**