Skip to content

Commit b8a6243

Browse files
committed
add lock
1 parent d383e89 commit b8a6243

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/PaimonHiveTestBase.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@
1818

1919
package org.apache.paimon.spark
2020

21+
import javolution.util.ReentrantLock
2122
import org.apache.paimon.hive.TestHiveMetastore
2223
import org.apache.paimon.table.FileStoreTable
23-
2424
import org.apache.hadoop.conf.Configuration
2525
import org.apache.spark.SparkConf
2626
import org.apache.spark.sql.paimon.Utils
2727

2828
import java.io.File
2929
import java.util.concurrent.ThreadLocalRandom
30+
import java.util.concurrent.locks.Lock
3031

3132
class PaimonHiveTestBase extends PaimonSparkTestBase {
3233

@@ -60,6 +61,7 @@ class PaimonHiveTestBase extends PaimonSparkTestBase {
6061
}
6162

6263
override protected def beforeAll(): Unit = {
64+
lock.lock()
6365
testHiveMetastore.start(hivePort)
6466
super.beforeAll()
6567
spark.sql(s"USE $sparkCatalogName")
@@ -71,6 +73,7 @@ class PaimonHiveTestBase extends PaimonSparkTestBase {
7173
spark.sql(s"USE $sparkCatalogName")
7274
spark.sql("USE default")
7375
spark.sql(s"DROP DATABASE $hiveDbName CASCADE")
76+
lock.unlock()
7477
} finally {
7578
super.afterAll()
7679
testHiveMetastore.stop()
@@ -97,4 +100,6 @@ object PaimonHiveTestBase {
97100
}
98101

99102
val hivePort: Int = hiveUri.split(":")(2).toInt
103+
104+
val lock = new ReentrantLock
100105
}

0 commit comments

Comments
 (0)