diff options
author | Michael Armbrust <michael@databricks.com> | 2014-10-01 14:37:27 -0700 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2014-10-01 14:37:27 -0700 |
commit | fcad3fae6135bc2c9bdaf9e4c3cfe24838e63eae (patch) | |
tree | a8919bce9dbf7adfbc9f862b2a5282f05728060f | |
parent | 17333c7a3c26ca6d28e8f3ca097da37d6b655217 (diff) | |
download | spark-fcad3fae6135bc2c9bdaf9e4c3cfe24838e63eae.tar.gz spark-fcad3fae6135bc2c9bdaf9e4c3cfe24838e63eae.tar.bz2 spark-fcad3fae6135bc2c9bdaf9e4c3cfe24838e63eae.zip |
[SPARK-3746][SQL] Lock hive client when creating tables
Author: Michael Armbrust <michael@databricks.com>
Closes #2598 from marmbrus/hiveClientLock and squashes the following commits:
ca89fe8 [Michael Armbrust] Lock hive client when creating tables
-rw-r--r-- | sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala index 9a0b9b46ac..06b1446ccb 100644 --- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala +++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala @@ -96,10 +96,12 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with serDeInfo.setParameters(Map[String, String]()) sd.setSerdeInfo(serDeInfo) - try client.createTable(table) catch { - case e: org.apache.hadoop.hive.ql.metadata.HiveException - if e.getCause.isInstanceOf[org.apache.hadoop.hive.metastore.api.AlreadyExistsException] && - allowExisting => // Do nothing. + synchronized { + try client.createTable(table) catch { + case e: org.apache.hadoop.hive.ql.metadata.HiveException + if e.getCause.isInstanceOf[org.apache.hadoop.hive.metastore.api.AlreadyExistsException] && + allowExisting => // Do nothing. + } } } |