Skip to content

Commit 2bc7fe7

Browse files
committed
Revert "[SPARK-6618][SQL] HiveMetastoreCatalog.lookupRelation should use fine-grained lock"
This reverts commit 314afd0.
1 parent 191524e commit 2bc7fe7

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,12 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
173173

174174
def lookupRelation(
175175
tableIdentifier: Seq[String],
176-
alias: Option[String]): LogicalPlan = {
176+
alias: Option[String]): LogicalPlan = synchronized {
177177
val tableIdent = processTableIdentifier(tableIdentifier)
178178
val databaseName = tableIdent.lift(tableIdent.size - 2).getOrElse(
179179
hive.sessionState.getCurrentDatabase)
180180
val tblName = tableIdent.last
181-
val table = try {
182-
synchronized {
183-
client.getTable(databaseName, tblName)
184-
}
185-
} catch {
181+
val table = try client.getTable(databaseName, tblName) catch {
186182
case te: org.apache.hadoop.hive.ql.metadata.InvalidTableException =>
187183
throw new NoSuchTableException
188184
}
@@ -204,9 +200,7 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
204200
} else {
205201
val partitions: Seq[Partition] =
206202
if (table.isPartitioned) {
207-
synchronized {
208-
HiveShim.getAllPartitionsOf(client, table).toSeq
209-
}
203+
HiveShim.getAllPartitionsOf(client, table).toSeq
210204
} else {
211205
Nil
212206
}

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -457,15 +457,4 @@ class SQLQuerySuite extends QueryTest {
457457
dropTempTable("data")
458458
setConf("spark.sql.hive.convertCTAS", originalConf)
459459
}
460-
461-
test("sanity test for SPARK-6618") {
462-
(1 to 100).par.map { i =>
463-
val tableName = s"SPARK_6618_table_$i"
464-
sql(s"CREATE TABLE $tableName (col1 string)")
465-
catalog.lookupRelation(Seq(tableName))
466-
table(tableName)
467-
tables()
468-
sql(s"DROP TABLE $tableName")
469-
}
470-
}
471460
}

0 commit comments

Comments
 (0)