You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by qi...@apache.org on 2018/08/15 02:53:54 UTC

carbondata git commit: [CARBONDATA-2854] Release the lock of tablestatus file in 'clean files' command before deleting physical files

Repository: carbondata
Updated Branches:
  refs/heads/master 8b9c65540 -> f66a9fdca


[CARBONDATA-2854] Release the lock of tablestatus file in 'clean files' command before deleting physical files

Release table status file lock before delete physical files, otherwise table status file will be locked during deleting physical files, it may take a long time, other operations will fail to get table status file lock.

This closes #2634


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

Branch: refs/heads/master
Commit: f66a9fdca12e2a3d92dd1762150d09c351e9c2a8
Parents: 8b9c655
Author: Zhang Zhichao <44...@qq.com>
Authored: Tue Aug 14 13:17:21 2018 +0800
Committer: QiangCai <qi...@qq.com>
Committed: Wed Aug 15 10:51:37 2018 +0800

----------------------------------------------------------------------
 .../core/statusmanager/SegmentStatusManager.java        | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/f66a9fdc/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java b/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
index daf54a0..fdce76b 100755
--- a/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
+++ b/core/src/main/java/org/apache/carbondata/core/statusmanager/SegmentStatusManager.java
@@ -934,6 +934,8 @@ public class SegmentStatusManager {
     CarbonLockUtil.deleteExpiredSegmentLockFiles(carbonTable);
     if (isLoadDeletionRequired(carbonTable.getMetadataPath())) {
       AbsoluteTableIdentifier identifier = carbonTable.getAbsoluteTableIdentifier();
+      boolean updationCompletionStatus = false;
+      LoadMetadataDetails[] newAddedLoadHistoryList = null;
       ReturnTuple tuple = isUpdationRequired(isForceDeletion, carbonTable, identifier);
       if (tuple.isUpdateRequired) {
         ICarbonLock carbonTableStatusLock =
@@ -958,7 +960,6 @@ public class SegmentStatusManager {
             int maxSegmentId = SegmentStatusManager.getMaxSegmentId(tuple2.details);
             int invisibleSegmentCnt = SegmentStatusManager.countInvisibleSegments(
                 tuple2.details, maxSegmentId);
-            LoadMetadataDetails[] newAddedLoadHistoryList = null;
             // if execute command 'clean files' or the number of invisible segment info
             // exceeds the value of 'carbon.invisible.segments.preserve.count',
             // it need to append the invisible segment list to 'tablestatus.history' file.
@@ -983,9 +984,7 @@ public class SegmentStatusManager {
                   updateLoadMetadataFromOldToNew(tuple2.details, latestMetadata);
               writeLoadMetadata(identifier, latestStatus);
             }
-            DeleteLoadFolders.physicalFactAndMeasureMetadataDeletion(
-                identifier, carbonTable.getMetadataPath(),
-                newAddedLoadHistoryList, isForceDeletion, partitionSpecs);
+            updationCompletionStatus = true;
           } else {
             String dbName = identifier.getCarbonTableIdentifier().getDatabaseName();
             String tableName = identifier.getCarbonTableIdentifier().getTableName();
@@ -1001,6 +1000,11 @@ public class SegmentStatusManager {
           if (locked) {
             CarbonLockUtil.fileUnlock(carbonTableStatusLock, LockUsage.TABLE_STATUS_LOCK);
           }
+          if (updationCompletionStatus) {
+            DeleteLoadFolders.physicalFactAndMeasureMetadataDeletion(
+                identifier, carbonTable.getMetadataPath(),
+                newAddedLoadHistoryList, isForceDeletion, partitionSpecs);
+          }
         }
       }
     }