carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jack...@apache.org
Subject [1/2] incubator-carbondata git commit: Fixed NLP while droping the table with HDFS lock
Date Mon, 09 Jan 2017 10:41:06 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master bc5a061e9 -> 45211a4c5


Fixed NLP while droping the table with HDFS lock

Fixed comment


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

Branch: refs/heads/master
Commit: 7af06e6fcef15d0e046ede3cd93b4cb19439d5ab
Parents: bc5a061
Author: ravipesala <ravi.pesala@gmail.com>
Authored: Fri Jan 6 15:06:02 2017 +0530
Committer: jackylk <jacky.likun@huawei.com>
Committed: Mon Jan 9 18:39:58 2017 +0800

----------------------------------------------------------------------
 .../org/apache/carbondata/locks/HdfsFileLock.java   | 14 +++++++++++---
 .../sql/execution/command/carbonTableSchema.scala   | 16 +++++++---------
 .../sql/execution/command/carbonTableSchema.scala   | 16 +++++++---------
 3 files changed, 25 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/7af06e6f/core/src/main/java/org/apache/carbondata/locks/HdfsFileLock.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/locks/HdfsFileLock.java b/core/src/main/java/org/apache/carbondata/locks/HdfsFileLock.java
index 75c6efd..961b4d8 100644
--- a/core/src/main/java/org/apache/carbondata/locks/HdfsFileLock.java
+++ b/core/src/main/java/org/apache/carbondata/locks/HdfsFileLock.java
@@ -25,6 +25,7 @@ import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.carbon.CarbonTableIdentifier;
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.datastorage.store.filesystem.CarbonFile;
 import org.apache.carbondata.core.datastorage.store.impl.FileFactory;
 import org.apache.carbondata.core.util.CarbonProperties;
 
@@ -108,10 +109,17 @@ public class HdfsFileLock extends AbstractCarbonLock {
       } catch (IOException e) {
         return false;
       } finally {
-        if (FileFactory.getCarbonFile(location, FileFactory.getFileType(location)).delete())
{
-          LOGGER.info("Deleted the lock file " + location);
+        CarbonFile carbonFile =
+            FileFactory.getCarbonFile(location, FileFactory.getFileType(location));
+        if (carbonFile.exists()) {
+          if (carbonFile.delete()) {
+            LOGGER.info("Deleted the lock file " + location);
+          } else {
+            LOGGER.error("Not able to delete the lock file " + location);
+          }
         } else {
-          LOGGER.error("Not able to delete the lock file " + location);
+          LOGGER.error("Not able to delete the lock file because "
+              + "it is not existed in location " + location);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/7af06e6f/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
b/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
index 865a0cf..8de8236 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
@@ -728,15 +728,13 @@ private[sql] case class DropTableCommand(ifExistsSet: Boolean, databaseNameOp:
O
             val file = FileFactory.getCarbonFile(metadataFilePath, fileType)
             CarbonUtil.deleteFoldersAndFiles(file.getParentFile)
           }
-          // delete bad record log after drop table
-          val badLogPath = CarbonUtil.getBadLogPath(dbName + File.separator + tableName)
-          val badLogFileType = FileFactory.getFileType(badLogPath)
-          if (FileFactory.isFileExist(badLogPath, badLogFileType)) {
-            val file = FileFactory.getCarbonFile(badLogPath, badLogFileType)
-            CarbonUtil.deleteFoldersAndFiles(file)
-          }
-        } else {
-          logError("Unable to unlock Table MetaData")
+        }
+        // delete bad record log after drop table
+        val badLogPath = CarbonUtil.getBadLogPath(dbName + File.separator + tableName)
+        val badLogFileType = FileFactory.getFileType(badLogPath)
+        if (FileFactory.isFileExist(badLogPath, badLogFileType)) {
+          val file = FileFactory.getCarbonFile(badLogPath, badLogFileType)
+          CarbonUtil.deleteFoldersAndFiles(file)
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/7af06e6f/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
index a38c77a..cf6d8a6 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
@@ -664,15 +664,13 @@ case class CarbonDropTableCommand(ifExistsSet: Boolean,
             val file = FileFactory.getCarbonFile(metadataFilePath, fileType)
             CarbonUtil.deleteFoldersAndFiles(file.getParentFile)
           }
-          // delete bad record log after drop table
-          val badLogPath = CarbonUtil.getBadLogPath(dbName + File.separator + tableName)
-          val badLogFileType = FileFactory.getFileType(badLogPath)
-          if (FileFactory.isFileExist(badLogPath, badLogFileType)) {
-            val file = FileFactory.getCarbonFile(badLogPath, badLogFileType)
-            CarbonUtil.deleteFoldersAndFiles(file)
-          }
-        } else {
-          logError("Unable to unlock Table MetaData")
+        }
+        // delete bad record log after drop table
+        val badLogPath = CarbonUtil.getBadLogPath(dbName + File.separator + tableName)
+        val badLogFileType = FileFactory.getFileType(badLogPath)
+        if (FileFactory.isFileExist(badLogPath, badLogFileType)) {
+          val file = FileFactory.getCarbonFile(badLogPath, badLogFileType)
+          CarbonUtil.deleteFoldersAndFiles(file)
         }
       }
     }


Mime
View raw message