GitHub user xuchuanyin opened a pull request:
https://github.com/apache/carbondata/pull/2871 [CARBONDATA-3051] Fix bugs in unclosed streams Failed to run CarbonReaderTests in windows env. This is due to two problems in carbondata: Problem 1: While encountering problems, we should close all the streams instead of only close current one. Problem 2: Current FileReader is not singleton nor the fileCache variable is a class variable, so it can only provide cache function if we pass the object among the methods. After reading version info, the fileReader cannot be used by other methods, so we must close it. Be sure to do all of the following checklist to help us incorporate your contribution quickly and easily: - [x] Any interfaces changed? `NA` - [x] Any backward compatibility impacted? `NA` - [x] Document update required? `NA` - [x] Testing done Please provide details on - Whether new unit test cases have been added or why no new tests are required? `NA, only fix bugs` - How it is tested? Please attach test report. `Tested in local machine` - Is it a performance related change? Please attach the performance test report. `NA` - Any additional information to help reviewers in testing this change. `NA` - [x] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. `NA` You can merge this pull request into a Git repository by running: $ git pull https://github.com/xuchuanyin/carbondata 181029_bug_close_stream Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/2871.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2871 ---- commit bf966bcc9bec3eab286f1fec7679d6e650c050d0 Author: xuchuanyin <xuchuanyin@...> Date: 2018-10-29T07:33:10Z Fix bugs in unclosed streams Failed to run CarbonReaderTests in windows env. This is due to two problems in carbondata: Problem 1: While encountering problems, we should close all the streams instead of only close current one. Problem 2: Current FileReader is not singleton nor the fileCache variable is a class variable, so it can only provide cache function if we pass the object among the methods. After reading version info, the fileReader cannot be used by other methods, so we must close it. ---- --- |
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2871 Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9372/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2871 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1111/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2871 Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1322/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2871 Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9376/ --- |
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2871#discussion_r229282082 --- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReaderBuilder.java --- @@ -169,7 +170,7 @@ public CarbonReaderBuilder withHadoopConf(String key, String value) { reader.initialize(split, attempt); readers.add(reader); } catch (Exception e) { - reader.close(); + CarbonUtil.closeStreams(readers.toArray(new RecordReader[0])); --- End diff -- Why not loop and close each one in the `readers`? --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2871#discussion_r229535208 --- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReaderBuilder.java --- @@ -169,7 +170,7 @@ public CarbonReaderBuilder withHadoopConf(String key, String value) { reader.initialize(split, attempt); readers.add(reader); } catch (Exception e) { - reader.close(); + CarbonUtil.closeStreams(readers.toArray(new RecordReader[0])); --- End diff -- `CarbonUtil.closeStreams` will loop and close the readers. Calling this will save the loc (line of code) --- |
In reply to this post by qiuchenjian-2
|
In reply to this post by qiuchenjian-2
|
Free forum by Nabble | Edit this page |