carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvram...@apache.org
Subject [1/2] incubator-carbondata git commit: Delete the lock file once the unlocking is done.
Date Tue, 23 Aug 2016 15:45:07 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 5ebf90a87 -> 645860592


Delete the lock file once the unlocking is done.


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

Branch: refs/heads/master
Commit: 61e40eb0033fca3ffc8d09d392b6090cde284652
Parents: 5ebf90a
Author: ravikiran <ravikiran.sn042@gmail.com>
Authored: Tue Aug 23 19:28:51 2016 +0530
Committer: Venkata Ramana G <ramana.gollamudi@huawei.com>
Committed: Tue Aug 23 20:47:38 2016 +0530

----------------------------------------------------------------------
 .../org/apache/carbondata/lcm/locks/HdfsFileLock.java  |  7 ++++++-
 .../org/apache/carbondata/lcm/locks/LocalFileLock.java | 13 +++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/61e40eb0/processing/src/main/java/org/apache/carbondata/lcm/locks/HdfsFileLock.java
----------------------------------------------------------------------
diff --git a/processing/src/main/java/org/apache/carbondata/lcm/locks/HdfsFileLock.java b/processing/src/main/java/org/apache/carbondata/lcm/locks/HdfsFileLock.java
index 0463525..a992614 100644
--- a/processing/src/main/java/org/apache/carbondata/lcm/locks/HdfsFileLock.java
+++ b/processing/src/main/java/org/apache/carbondata/lcm/locks/HdfsFileLock.java
@@ -68,7 +68,6 @@ public class HdfsFileLock extends AbstractCarbonLock {
   public HdfsFileLock(CarbonTableIdentifier tableIdentifier, String lockFile) {
     this(tableIdentifier.getDatabaseName() + CarbonCommonConstants.FILE_SEPARATOR + tableIdentifier
         .getTableName(), lockFile);
-    initRetry();
   }
 
   /* (non-Javadoc)
@@ -98,6 +97,12 @@ public class HdfsFileLock extends AbstractCarbonLock {
         dataOutputStream.close();
       } catch (IOException e) {
         return false;
+      } finally {
+        if (FileFactory.getCarbonFile(location, FileFactory.getFileType(location)).delete())
{
+          LOGGER.info("Deleted the lock file " + location);
+        } else {
+          LOGGER.error("Not able to delete the lock file " + location);
+        }
       }
     }
     return true;

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/61e40eb0/processing/src/main/java/org/apache/carbondata/lcm/locks/LocalFileLock.java
----------------------------------------------------------------------
diff --git a/processing/src/main/java/org/apache/carbondata/lcm/locks/LocalFileLock.java b/processing/src/main/java/org/apache/carbondata/lcm/locks/LocalFileLock.java
index 2a51e21..f1103b1 100644
--- a/processing/src/main/java/org/apache/carbondata/lcm/locks/LocalFileLock.java
+++ b/processing/src/main/java/org/apache/carbondata/lcm/locks/LocalFileLock.java
@@ -62,9 +62,7 @@ public class LocalFileLock extends AbstractCarbonLock {
 
   public static final String tmpPath;
 
-  private String tableName;
-
-  private String databaseName;
+  private  String lockFilePath;
 
   /**
    * LOGGER for  logging the messages.
@@ -106,7 +104,7 @@ public class LocalFileLock extends AbstractCarbonLock {
       if (!FileFactory.isFileExist(location, FileFactory.getFileType(tmpPath))) {
         FileFactory.mkdirs(location, FileFactory.getFileType(tmpPath));
       }
-      String lockFilePath = location + CarbonCommonConstants.FILE_SEPARATOR +
+      lockFilePath = location + CarbonCommonConstants.FILE_SEPARATOR +
           lockFile;
       if (!FileFactory.isFileExist(lockFilePath, FileFactory.getFileType(location))) {
         FileFactory.createNewLockFile(lockFilePath, FileFactory.getFileType(location));
@@ -148,6 +146,13 @@ public class LocalFileLock extends AbstractCarbonLock {
       if (null != fileOutputStream) {
         try {
           fileOutputStream.close();
+          // deleting the lock file after releasing the lock.
+          if (FileFactory.getCarbonFile(lockFilePath, FileFactory.getFileType(lockFilePath))
+              .delete()) {
+            LOGGER.info("Successfully deleted the lock file " + lockFilePath);
+          } else {
+            LOGGER.error("Not able to delete the lock file " + lockFilePath);
+          }
         } catch (IOException e) {
           LOGGER.error(e.getMessage());
         }


Mime
View raw message