carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [32/47] incubator-carbondata git commit: [CARBONDATA-110] delete segment selected for compaction. (#874)
Date Mon, 01 Aug 2016 10:05:30 GMT
[CARBONDATA-110] delete segment selected for compaction. (#874)

 if the compaction is running and the user deleted the segment which is under compaction.
then not updating the table status, and printing the error message in compaction.
if the compaction is running and the user deleted the segment which is under compaction.
then not updating the table status, and printing the error message in compaction.

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

Branch: refs/heads/master
Commit: bf7f9f7d15c430adc629508d6a5fed1d8edbc7b7
Parents: 973def9
Author: ravikiran23 <ravikiran.sn042@gmail.com>
Authored: Thu Jul 28 21:41:13 2016 +0530
Committer: sujith71955 <sujithchacko.2010@gmail.com>
Committed: Thu Jul 28 21:41:13 2016 +0530

----------------------------------------------------------------------
 .../spark/merger/CarbonDataMergerUtil.java      |  8 +++++
 .../org/carbondata/spark/rdd/Compactor.scala    | 31 +++++++++++++-------
 2 files changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/bf7f9f7d/integration/spark/src/main/java/org/carbondata/spark/merger/CarbonDataMergerUtil.java
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/java/org/carbondata/spark/merger/CarbonDataMergerUtil.java
b/integration/spark/src/main/java/org/carbondata/spark/merger/CarbonDataMergerUtil.java
index f033993..b290dd5 100644
--- a/integration/spark/src/main/java/org/carbondata/spark/merger/CarbonDataMergerUtil.java
+++ b/integration/spark/src/main/java/org/carbondata/spark/merger/CarbonDataMergerUtil.java
@@ -161,6 +161,14 @@ public final class CarbonDataMergerUtil {
         for (LoadMetadataDetails loadDetail : loadDetails) {
           // check if this segment is merged.
           if (loadsToMerge.contains(loadDetail)) {
+            // if the compacted load is deleted after the start of the compaction process,
+            // then need to discard the compaction process and treat it as failed compaction.
+            if (loadDetail.getLoadStatus()
+                .equalsIgnoreCase(CarbonCommonConstants.MARKED_FOR_DELETE)) {
+              LOGGER.error("Compaction is aborted as the segment " + loadDetail.getLoadName()
+                  + " is deleted after the compaction is started.");
+              return tableStatusUpdationStatus;
+            }
             loadDetail.setLoadStatus(CarbonCommonConstants.SEGMENT_COMPACTED);
             loadDetail.setModificationOrdeletionTimesStamp(modificationOrDeletionTimeStamp);
             loadDetail.setMergedLoadName(mergedLoadNumber);

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/bf7f9f7d/integration/spark/src/main/scala/org/carbondata/spark/rdd/Compactor.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/carbondata/spark/rdd/Compactor.scala b/integration/spark/src/main/scala/org/carbondata/spark/rdd/Compactor.scala
index 7e19ded..2b17d57 100644
--- a/integration/spark/src/main/scala/org/carbondata/spark/rdd/Compactor.scala
+++ b/integration/spark/src/main/scala/org/carbondata/spark/rdd/Compactor.scala
@@ -115,18 +115,29 @@ object Compactor {
     if (finalMergeStatus) {
       val endTime = System.nanoTime();
       logger.info("time taken to merge " + mergedLoadName + " is " + (endTime - startTime))
-      CarbonDataMergerUtil
+      if (!CarbonDataMergerUtil
         .updateLoadMetadataWithMergeStatus(loadsToMerge, carbonTable.getMetaDataFilepath(),
           mergedLoadName, carbonLoadModel, mergeLoadStartTime, compactionType
-        )
-      logger
-        .audit("Compaction request completed for table " + carbonLoadModel
-          .getDatabaseName + "." + carbonLoadModel.getTableName
-        )
-      logger
-        .info("Compaction request completed for table " + carbonLoadModel
-          .getDatabaseName + "." + carbonLoadModel.getTableName
-        )
+        )) {
+        logger
+          .audit("Compaction request failed for table " + carbonLoadModel
+            .getDatabaseName + "." + carbonLoadModel.getTableName
+          )
+        logger
+          .error("Compaction request failed for table " + carbonLoadModel
+            .getDatabaseName + "." + carbonLoadModel.getTableName
+          )
+      }
+      else {
+        logger
+          .audit("Compaction request completed for table " + carbonLoadModel
+            .getDatabaseName + "." + carbonLoadModel.getTableName
+          )
+        logger
+          .info("Compaction request completed for table " + carbonLoadModel
+            .getDatabaseName + "." + carbonLoadModel.getTableName
+          )
+      }
     }
     else {
       logger


Mime
View raw message