carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject carbondata git commit: [CARBONDATA-1912] Handling lock issues
Date Fri, 22 Dec 2017 04:35:43 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master a8cbacf3e -> fc93de163


[CARBONDATA-1912] Handling lock issues

Description :
Getting error trace in spark-sql console while executing compaction and alter table rename
commands.

Scenario:
execute compaction and alter table rename queries in spark - sql
Even though operation is success , getting error trace on the console

Solution: In compaction we are already handling unlock after operation , so we can handle
unlock in catch block instead of finally block.
In alter table rename operation: no need to unlock file on old location which will result
error due to table name change.

This closes #1684


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

Branch: refs/heads/master
Commit: fc93de163f472db92243fdfd5ef119765da97237
Parents: a8cbacf
Author: Manohar <manohar.crazy09@gmail.com>
Authored: Tue Dec 19 19:12:14 2017 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Fri Dec 22 10:05:26 2017 +0530

----------------------------------------------------------------------
 .../command/management/CarbonAlterTableCompactionCommand.scala  | 5 ++---
 .../command/schema/CarbonAlterTableRenameCommand.scala          | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/fc93de16/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
index 517fbda..45d3537 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/management/CarbonAlterTableCompactionCommand.scala
@@ -227,7 +227,7 @@ case class CarbonAlterTableCompactionCommand(
                 "")
             OperationListenerBus.getInstance
               .fireEvent(alterTableCompactionPreStatusUpdateEvent, operationContext)
-
+          lock.unlock()
           } else {
             CarbonDataRDDFactory.startCompactionThreads(
               sqlContext,
@@ -241,9 +241,8 @@ case class CarbonAlterTableCompactionCommand(
         } catch {
           case e: Exception =>
             LOGGER.error(s"Exception in start compaction thread. ${ e.getMessage }")
+            lock.unlock()
             throw e
-        } finally {
-          lock.unlock()
         }
       } else {
         LOGGER.audit("Not able to acquire the compaction lock for table " +

http://git-wip-us.apache.org/repos/asf/carbondata/blob/fc93de16/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonAlterTableRenameCommand.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonAlterTableRenameCommand.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonAlterTableRenameCommand.scala
index 1766064..28ed581 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonAlterTableRenameCommand.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonAlterTableRenameCommand.scala
@@ -166,10 +166,10 @@ private[sql] case class CarbonAlterTableRenameCommand(
               sparkSession)
           renameBadRecords(newTableName, oldTableName, oldDatabaseName)
         }
+        // release lock from old location in case of any rename failure
+        AlterTableUtil.releaseLocks(locks)
         sys.error(s"Alter table rename table operation failed: ${e.getMessage}")
     } finally {
-      // release lock after command execution completion
-      AlterTableUtil.releaseLocks(locks)
       // case specific to rename table as after table rename old table path will not be found
       if (carbonTable != null) {
         val newTablePath = CarbonUtil


Mime
View raw message