You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ra...@apache.org on 2016/11/07 11:51:55 UTC

[2/5] incubator-carbondata git commit: When data load and drop is executed concurrently, then even though drop didn't get lock, its table files.

When data load and drop is executed concurrently, then even though drop didn't get lock, its table files.


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

Branch: refs/heads/branch-0.2
Commit: 91d94e7a203d5521d40866c2fc1ba1355b1e7577
Parents: 0306614
Author: Ashok <as...@gmail.com>
Authored: Thu Nov 3 07:37:59 2016 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Mon Nov 7 17:12:15 2016 +0530

----------------------------------------------------------------------
 .../apache/spark/sql/execution/command/carbonTableSchema.scala | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/91d94e7a/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 5599ae0..0e87eb9 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
@@ -1258,8 +1258,10 @@ private[sql] case class DropTableCommand(ifExistsSet: Boolean, databaseNameOp: O
     val carbonLock = CarbonLockFactory
       .getCarbonLockObj(carbonTableIdentifier, LockUsage.DROP_TABLE_LOCK)
     val storePath = CarbonEnv.getInstance(sqlContext).carbonCatalog.storePath
+    var isLocked = false
     try {
-      if (carbonLock.lockWithRetries()) {
+      isLocked = carbonLock.lockWithRetries()
+      if (isLocked) {
         logInfo("Successfully able to get the lock for drop.")
       }
       else {
@@ -1271,7 +1273,7 @@ private[sql] case class DropTableCommand(ifExistsSet: Boolean, databaseNameOp: O
       LOGGER.audit(s"Deleted table [$tableName] under database [$dbName]")
     }
     finally {
-      if (carbonLock != null) {
+      if (carbonLock != null && isLocked) {
         if (carbonLock.unlock()) {
           logInfo("Table MetaData Unlocked Successfully after dropping the table")
           // deleting any remaining files.