carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [38/50] [abbrv] incubator-carbondata git commit: [CARBONDATA-75] Dictionary file not getting cleanup on global dictionary generation failure
Date Wed, 20 Jul 2016 10:14:06 GMT
[CARBONDATA-75] Dictionary file not getting cleanup on global dictionary generation failure

1.Corrected sorted index cleanup. (#838)
2.dictionary clean up on failure.

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

Branch: refs/heads/master
Commit: 5d8f9d097edfab36e41508501f4a3ddbafebd1d7
Parents: 233d13f
Author: ashokblend <ashok.blend@gmail.com>
Authored: Tue Jul 19 01:13:51 2016 +0530
Committer: Kumar Vishal <kumarvishal.1802@gmail.com>
Committed: Tue Jul 19 01:13:51 2016 +0530

----------------------------------------------------------------------
 .../core/writer/CarbonDictionaryWriterImpl.java           |  6 +++++-
 .../sortindex/CarbonDictionarySortIndexWriterImpl.java    | 10 +++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/5d8f9d09/core/src/main/java/org/carbondata/core/writer/CarbonDictionaryWriterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/core/writer/CarbonDictionaryWriterImpl.java
b/core/src/main/java/org/carbondata/core/writer/CarbonDictionaryWriterImpl.java
index f174f70..2508c86 100644
--- a/core/src/main/java/org/carbondata/core/writer/CarbonDictionaryWriterImpl.java
+++ b/core/src/main/java/org/carbondata/core/writer/CarbonDictionaryWriterImpl.java
@@ -238,9 +238,13 @@ public class CarbonDictionaryWriterImpl implements CarbonDictionaryWriter
{
   private void init() throws IOException {
     initDictionaryChunkSize();
     initPaths();
-    if (CarbonUtil.isFileExists(this.dictionaryFilePath)) {
+    boolean dictFileExists = CarbonUtil.isFileExists(this.dictionaryFilePath);
+    if (dictFileExists && CarbonUtil.isFileExists(this.dictionaryMetaFilePath)) {
       this.chunk_start_offset = CarbonUtil.getFileSize(this.dictionaryFilePath);
       validateDictionaryFileOffsetWithLastSegmentEntryOffset();
+    } else if (dictFileExists) {
+      FileFactory.getCarbonFile(dictionaryFilePath, FileFactory.getFileType(dictionaryFilePath))
+          .delete();
     }
     openThriftWriter(this.dictionaryFilePath);
     createChunkList();

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/5d8f9d09/core/src/main/java/org/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImpl.java
b/core/src/main/java/org/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImpl.java
index f0b935c..9c398cb 100644
--- a/core/src/main/java/org/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImpl.java
+++ b/core/src/main/java/org/carbondata/core/writer/sortindex/CarbonDictionarySortIndexWriterImpl.java
@@ -158,7 +158,7 @@ public class CarbonDictionarySortIndexWriterImpl implements CarbonDictionarySort
     long dictOffset = CarbonUtil.getFileSize(dictionaryPath);
     this.sortIndexFilePath =
         carbonTablePath.getSortIndexFilePath(columnIdentifier.getColumnId(), dictOffset);
-    cleanUpOldSortIndex(carbonTablePath);
+    cleanUpOldSortIndex(carbonTablePath, dictionaryPath);
   }
 
   /**
@@ -166,11 +166,11 @@ public class CarbonDictionarySortIndexWriterImpl implements CarbonDictionarySort
    *
    * @param carbonTablePath
    */
-  protected void cleanUpOldSortIndex(CarbonTablePath carbonTablePath) {
-    CarbonFile sortIndexFile =
-        FileFactory.getCarbonFile(sortIndexFilePath, FileFactory.getFileType(sortIndexFilePath));
+  protected void cleanUpOldSortIndex(CarbonTablePath carbonTablePath, String dictPath) {
+    CarbonFile dictFile =
+        FileFactory.getCarbonFile(dictPath, FileFactory.getFileType(dictPath));
     CarbonFile[] files =
-        carbonTablePath.getSortIndexFiles(sortIndexFile.getParentFile(),
+        carbonTablePath.getSortIndexFiles(dictFile.getParentFile(),
             columnIdentifier.getColumnId());
     int maxTime;
     try {


Mime
View raw message