GitHub user kevinjmh opened a pull request:
https://github.com/apache/carbondata/pull/2879 [CARBONDATA-3058] Fix some exception coding in data loading 1. when exception occur in `dataHandler.finish();`, carbon does not proceed it immediately. Carbon keeps the exception and calls method to close the datahandler. But the exception would be overwrite if another exception occur when closing the dataHandler. This makes us lost the root cause. Refer to `AbstractFactDataWriter.closeExecutorService()` and `CarbonFactDataWriterImplV3.closeWriter()`, we add null check before the second time assignment in `CarbonRowDataWriterProcessorStepImpl.finish()` and `DataWriterBatchProcessorStepImpl` to avoid exception overwrite. 2. remove irrelevant exception message "unable to generate the mdkey", use the exception itself directly. Message in the exception will be retrieved automatically when logging. Be sure to do all of the following checklist to help us incorporate your contribution quickly and easily: - [ ] Any interfaces changed? - [ ] Any backward compatibility impacted? - [ ] Document update required? - [ ] Testing done Please provide details on - Whether new unit test cases have been added or why no new tests are required? - How it is tested? Please attach test report. - Is it a performance related change? Please attach the performance test report. - Any additional information to help reviewers in testing this change. - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. You can merge this pull request into a Git repository by running: $ git pull https://github.com/kevinjmh/carbondata exceptionFix Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/2879.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 #2879 ---- commit a36f9c98338e1ae38a9c4d9afb4bcd5ab1eb9b23 Author: Manhua <kevinjmh@...> Date: 2018-10-29T11:05:03Z fix exception ---- --- |
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2879#discussion_r229194409 --- Diff: processing/src/main/java/org/apache/carbondata/processing/loading/steps/CarbonRowDataWriterProcessorStepImpl.java --- @@ -212,7 +212,11 @@ private void finish(CarbonFactHandler dataHandler, int iteratorIndex) { try { processingComplete(dataHandler); } catch (CarbonDataLoadingException e) { - exception = new CarbonDataWriterException(e.getMessage(), e); + // only assign when exception is null + // else it will erase original root cause + if (null == exception) { + exception = new CarbonDataWriterException(e.getMessage(), e); --- End diff -- ```suggestion exception = new CarbonDataWriterException(e); ``` --- |
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/2879#discussion_r229194455 --- Diff: processing/src/main/java/org/apache/carbondata/processing/loading/steps/DataWriterBatchProcessorStepImpl.java --- @@ -141,7 +141,9 @@ private void finish(String tableName, CarbonFactHandler dataHandler) { try { processingComplete(dataHandler); } catch (Exception e) { - exception = new CarbonDataWriterException(e.getMessage(), e); + if (null == exception) { + exception = new CarbonDataWriterException(e.getMessage(), e); --- End diff -- ```suggestion exception = new CarbonDataWriterException(e); ``` --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2879 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1143/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2879 Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9404/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2879 Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1355/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2879 Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9408/ --- |
In reply to this post by qiuchenjian-2
Github user kevinjmh commented on the issue:
https://github.com/apache/carbondata/pull/2879 retest this please --- |
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/2879#discussion_r229280016 --- Diff: processing/src/main/java/org/apache/carbondata/processing/loading/steps/CarbonRowDataWriterProcessorStepImpl.java --- @@ -212,7 +212,11 @@ private void finish(CarbonFactHandler dataHandler, int iteratorIndex) { try { processingComplete(dataHandler); } catch (CarbonDataLoadingException e) { - exception = new CarbonDataWriterException(e.getMessage(), e); + // only assign when exception is null + // else it will erase original root cause + if (null == exception) { --- End diff -- Why should we keep this exceptionï¼If we only want to do some statistics, we can add that code in finally code block and you can just throw the exception in catch code block --- |
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/2879#discussion_r229280426 --- Diff: processing/src/main/java/org/apache/carbondata/processing/loading/steps/DataWriterBatchProcessorStepImpl.java --- @@ -141,7 +141,9 @@ private void finish(String tableName, CarbonFactHandler dataHandler) { try { processingComplete(dataHandler); } catch (Exception e) { - exception = new CarbonDataWriterException(e.getMessage(), e); + if (null == exception) { --- End diff -- no need to keep the exception here. you can do the statistics in finally code block --- |
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/2879#discussion_r229280564 --- Diff: processing/src/main/java/org/apache/carbondata/processing/loading/steps/DataWriterProcessorStepImpl.java --- @@ -259,7 +259,7 @@ public void processRow(CarbonRow row, CarbonFactHandler dataHandler) throws KeyG readCounter++; dataHandler.addDataToStore(row); } catch (Exception e) { - throw new CarbonDataLoadingException("unable to generate the mdkey", e); --- End diff -- no need to wrap the exception, just remove the try-catch code --- |
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/2879#discussion_r229280235 --- Diff: processing/src/main/java/org/apache/carbondata/processing/loading/steps/CarbonRowDataWriterProcessorStepImpl.java --- @@ -308,7 +312,7 @@ private void processBatch(CarbonRowBatch batch, CarbonFactHandler dataHandler, i } writeCounter[iteratorIndex] += batch.getSize(); } catch (Exception e) { - throw new CarbonDataLoadingException("unable to generate the mdkey", e); + throw new CarbonDataLoadingException(e); --- End diff -- I think there is no need to wrap the exception here, just remove the try-catch code. --- |
In reply to this post by qiuchenjian-2
Github user kevinjmh commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2879#discussion_r229285339 --- Diff: processing/src/main/java/org/apache/carbondata/processing/loading/steps/CarbonRowDataWriterProcessorStepImpl.java --- @@ -212,7 +212,11 @@ private void finish(CarbonFactHandler dataHandler, int iteratorIndex) { try { processingComplete(dataHandler); } catch (CarbonDataLoadingException e) { - exception = new CarbonDataWriterException(e.getMessage(), e); + // only assign when exception is null + // else it will erase original root cause + if (null == exception) { --- End diff -- not for the statistics. better to read the whole method. It has two stages: finish the handler and close the handler. the exception could be assigned in either stage. --- |
In reply to this post by qiuchenjian-2
Github user kevinjmh commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2879#discussion_r229287888 --- Diff: processing/src/main/java/org/apache/carbondata/processing/loading/steps/CarbonRowDataWriterProcessorStepImpl.java --- @@ -308,7 +312,7 @@ private void processBatch(CarbonRowBatch batch, CarbonFactHandler dataHandler, i } writeCounter[iteratorIndex] += batch.getSize(); } catch (Exception e) { - throw new CarbonDataLoadingException("unable to generate the mdkey", e); + throw new CarbonDataLoadingException(e); --- End diff -- The KeyGenException extend Exception, it needs CarbonDataLoadingException(RuntimeException) to wrap and throw. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2879 Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1371/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2879 Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9422/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2879 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1159/ --- |
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on the issue:
https://github.com/apache/carbondata/pull/2879 @kevinjmh OK, no better solutions for that, so current implementation is OK for me --- |
In reply to this post by qiuchenjian-2
|
In reply to this post by qiuchenjian-2
|
Free forum by Nabble | Edit this page |