You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ad...@apache.org on 2014/07/15 09:14:00 UTC

git commit: [SPARK-2485][SQL] Lock usage of hive client.

Repository: spark
Updated Branches:
  refs/heads/master c6d75745d -> c7c7ac833


[SPARK-2485][SQL] Lock usage of hive client.

Author: Michael Armbrust <mi...@databricks.com>

Closes #1412 from marmbrus/lockHiveClient and squashes the following commits:

4bc9d5a [Michael Armbrust] protected[hive]
22e9177 [Michael Armbrust] Add comments.
7aa8554 [Michael Armbrust] Don't lock on hive's object.
a6edc5f [Michael Armbrust] Lock usage of hive client.


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

Branch: refs/heads/master
Commit: c7c7ac83392b10abb011e6aead1bf92e7c73695e
Parents: c6d7574
Author: Michael Armbrust <mi...@databricks.com>
Authored: Tue Jul 15 00:13:51 2014 -0700
Committer: Aaron Davidson <aa...@databricks.com>
Committed: Tue Jul 15 00:13:51 2014 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/c7c7ac83/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
----------------------------------------------------------------------
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 f830688..8db60d3 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
@@ -43,14 +43,15 @@ import scala.collection.JavaConversions._
 private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with Logging {
   import HiveMetastoreTypes._
 
-  val client = Hive.get(hive.hiveconf)
+  /** Connection to hive metastore.  Usages should lock on `this`. */
+  protected[hive] val client = Hive.get(hive.hiveconf)
 
   val caseSensitive: Boolean = false
 
   def lookupRelation(
       db: Option[String],
       tableName: String,
-      alias: Option[String]): LogicalPlan = {
+      alias: Option[String]): LogicalPlan = synchronized {
     val (dbName, tblName) = processDatabaseAndTableName(db, tableName)
     val databaseName = dbName.getOrElse(hive.sessionState.getCurrentDatabase)
     val table = client.getTable(databaseName, tblName)