carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [18/50] [abbrv] carbondata git commit: [CARBONDATA-1210] Exception should be thrown on bad record logger failure to write to log file or csv file.
Date Wed, 05 Jul 2017 00:44:27 GMT
[CARBONDATA-1210] Exception should be thrown on bad record logger failure to write to log file
or csv file.


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/65a73612
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/65a73612
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/65a73612

Branch: refs/heads/streaming_ingest
Commit: 65a7361251a6430e05783e6dfa422b26cf0872ba
Parents: 7efc49d
Author: mohammadshahidkhan <mohdshahidkhan1987@gmail.com>
Authored: Wed Jun 21 17:21:26 2017 +0530
Committer: Venkata Ramana G <ramana.gollamudi@huawei.com>
Committed: Wed Jun 28 18:03:17 2017 +0530

----------------------------------------------------------------------
 .../csvbased/BadRecordsLogger.java                  | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/65a73612/processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/BadRecordsLogger.java
----------------------------------------------------------------------
diff --git a/processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/BadRecordsLogger.java
b/processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/BadRecordsLogger.java
index 9020c1d..66b6e71 100644
--- a/processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/BadRecordsLogger.java
+++ b/processing/src/main/java/org/apache/carbondata/processing/surrogatekeysgenerator/csvbased/BadRecordsLogger.java
@@ -33,6 +33,7 @@ import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.datastore.impl.FileFactory;
 import org.apache.carbondata.core.datastore.impl.FileFactory.FileType;
 import org.apache.carbondata.core.util.CarbonUtil;
+import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
 
 public class BadRecordsLogger {
 
@@ -118,7 +119,8 @@ public class BadRecordsLogger {
     return badRecordEntry.remove(key);
   }
 
-  public void addBadRecordsToBuilder(Object[] row, String reason) {
+  public void addBadRecordsToBuilder(Object[] row, String reason)
+      throws CarbonDataLoadingException {
     if (badRecordsLogRedirect || badRecordLoggerEnable) {
       StringBuilder logStrings = new StringBuilder();
       int size = row.length;
@@ -166,7 +168,8 @@ public class BadRecordsLogger {
   /**
    *
    */
-  private synchronized void writeBadRecordsToFile(StringBuilder logStrings) {
+  private synchronized void writeBadRecordsToFile(StringBuilder logStrings)
+      throws CarbonDataLoadingException {
     if (null == logFilePath) {
       logFilePath =
           this.storePath + File.separator + this.fileName + CarbonCommonConstants.LOG_FILE_EXTENSION
@@ -193,8 +196,10 @@ public class BadRecordsLogger {
       bufferedWriter.newLine();
     } catch (FileNotFoundException e) {
       LOGGER.error("Bad Log Files not found");
+      throw new CarbonDataLoadingException("Bad Log Files not found", e);
     } catch (IOException e) {
-      LOGGER.error("Error While writing bad log File");
+      LOGGER.error("Error While writing bad record log File");
+      throw new CarbonDataLoadingException("Error While writing bad record log File", e);
     } finally {
       // if the Bad record file is created means it partially success
       // if any entry present with key that means its have bad record for
@@ -208,7 +213,8 @@ public class BadRecordsLogger {
    *
    * @param logStrings
    */
-  private synchronized void writeBadRecordsToCSVFile(StringBuilder logStrings) {
+  private synchronized void writeBadRecordsToCSVFile(StringBuilder logStrings)
+      throws CarbonDataLoadingException {
     if (null == csvFilePath) {
       csvFilePath =
           this.storePath + File.separator + this.fileName + CarbonCommonConstants.CSV_FILE_EXTENSION
@@ -235,8 +241,10 @@ public class BadRecordsLogger {
       bufferedCSVWriter.newLine();
     } catch (FileNotFoundException e) {
       LOGGER.error("Bad record csv Files not found");
+      throw new CarbonDataLoadingException("Bad record csv Files not found", e);
     } catch (IOException e) {
       LOGGER.error("Error While writing bad record csv File");
+      throw new CarbonDataLoadingException("Error While writing bad record csv File", e);
     }
     finally {
       badRecordEntry.put(taskKey, "Partially");


Mime
View raw message