Skip to content
Snippets Groups Projects
Commit 2bc7fe7f authored by Cheng Lian's avatar Cheng Lian
Browse files

Revert "[SPARK-6618][SQL] HiveMetastoreCatalog.lookupRelation should use fine-grained lock"

This reverts commit 314afd0e.
parent 191524e7
No related branches found
No related tags found
No related merge requests found
...@@ -173,16 +173,12 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with ...@@ -173,16 +173,12 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
def lookupRelation( def lookupRelation(
tableIdentifier: Seq[String], tableIdentifier: Seq[String],
alias: Option[String]): LogicalPlan = { alias: Option[String]): LogicalPlan = synchronized {
val tableIdent = processTableIdentifier(tableIdentifier) val tableIdent = processTableIdentifier(tableIdentifier)
val databaseName = tableIdent.lift(tableIdent.size - 2).getOrElse( val databaseName = tableIdent.lift(tableIdent.size - 2).getOrElse(
hive.sessionState.getCurrentDatabase) hive.sessionState.getCurrentDatabase)
val tblName = tableIdent.last val tblName = tableIdent.last
val table = try { val table = try client.getTable(databaseName, tblName) catch {
synchronized {
client.getTable(databaseName, tblName)
}
} catch {
case te: org.apache.hadoop.hive.ql.metadata.InvalidTableException => case te: org.apache.hadoop.hive.ql.metadata.InvalidTableException =>
throw new NoSuchTableException throw new NoSuchTableException
} }
...@@ -204,9 +200,7 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with ...@@ -204,9 +200,7 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
} else { } else {
val partitions: Seq[Partition] = val partitions: Seq[Partition] =
if (table.isPartitioned) { if (table.isPartitioned) {
synchronized { HiveShim.getAllPartitionsOf(client, table).toSeq
HiveShim.getAllPartitionsOf(client, table).toSeq
}
} else { } else {
Nil Nil
} }
......
...@@ -457,15 +457,4 @@ class SQLQuerySuite extends QueryTest { ...@@ -457,15 +457,4 @@ class SQLQuerySuite extends QueryTest {
dropTempTable("data") dropTempTable("data")
setConf("spark.sql.hive.convertCTAS", originalConf) setConf("spark.sql.hive.convertCTAS", originalConf)
} }
test("sanity test for SPARK-6618") {
(1 to 100).par.map { i =>
val tableName = s"SPARK_6618_table_$i"
sql(s"CREATE TABLE $tableName (col1 string)")
catalog.lookupRelation(Seq(tableName))
table(tableName)
tables()
sql(s"DROP TABLE $tableName")
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment