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/03/23 14:07:29 UTC

carbondata git commit: [CARBONDATA-2221] Throw exception when dropTable failed in metastore

Repository: carbondata
Updated Branches:
  refs/heads/master 873c3ded0 -> 5725b7eb1


[CARBONDATA-2221] Throw exception when dropTable failed in metastore

This closes #2021


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

Branch: refs/heads/master
Commit: 5725b7eb18043c442ee43251a8b461aaf4a89f92
Parents: 873c3de
Author: Jacky Li <ja...@qq.com>
Authored: Fri Mar 2 15:46:27 2018 +0800
Committer: QiangCai <qi...@qq.com>
Committed: Fri Mar 23 22:06:50 2018 +0800

----------------------------------------------------------------------
 .../execution/command/table/CarbonCreateTableCommand.scala  | 9 ++++++---
 .../org/apache/spark/sql/hive/CarbonFileMetastore.scala     | 2 +-
 .../org/apache/spark/sql/hive/CarbonHiveMetadataUtil.scala  | 1 +
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/5725b7eb/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonCreateTableCommand.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonCreateTableCommand.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonCreateTableCommand.scala
index 22dab27..e0e51ed 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonCreateTableCommand.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonCreateTableCommand.scala
@@ -136,9 +136,12 @@ case class CarbonCreateTableCommand(
           case e: AnalysisException => throw e
           case e: Exception =>
             // call the drop table to delete the created table.
-            CarbonEnv.getInstance(sparkSession).carbonMetastore
-              .dropTable(tableIdentifier)(sparkSession)
-
+            try {
+              CarbonEnv.getInstance(sparkSession).carbonMetastore
+                .dropTable(tableIdentifier)(sparkSession)
+            } catch {
+              case _: Exception => // No operation
+            }
             val msg = s"Create table'$tableName' in database '$dbName' failed"
             LOGGER.audit(msg.concat(", ").concat(e.getMessage))
             LOGGER.error(e, msg)

http://git-wip-us.apache.org/repos/asf/carbondata/blob/5725b7eb/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonFileMetastore.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonFileMetastore.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonFileMetastore.scala
index 52bae1a..ea0dd3a 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonFileMetastore.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonFileMetastore.scala
@@ -441,8 +441,8 @@ class CarbonFileMetastore extends CarbonMetaStore {
       checkSchemasModifiedTimeAndReloadTable(TableIdentifier(tableName, Some(dbName)))
 
       removeTableFromMetadata(dbName, tableName)
-      updateSchemasUpdatedTime(touchSchemaFileSystemTime())
       CarbonHiveMetadataUtil.invalidateAndDropTable(dbName, tableName, sparkSession)
+      updateSchemasUpdatedTime(touchSchemaFileSystemTime())
       // discard cached table info in cachedDataSourceTables
       val tableIdentifier = TableIdentifier(tableName, Option(dbName))
       sparkSession.sessionState.catalog.refreshTable(tableIdentifier)

http://git-wip-us.apache.org/repos/asf/carbondata/blob/5725b7eb/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonHiveMetadataUtil.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonHiveMetadataUtil.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonHiveMetadataUtil.scala
index dfa9904..8123637 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonHiveMetadataUtil.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonHiveMetadataUtil.scala
@@ -49,6 +49,7 @@ object CarbonHiveMetadataUtil {
         LOGGER.error(
           s"Error While deleting the table $databaseName.$tableName during drop carbon table" +
           e.getMessage)
+        throw e
     }
   }