You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by we...@apache.org on 2020/05/15 06:37:46 UTC

[spark] branch master updated: [SPARK-31715][SQL][TEST] Fix flaky SparkSQLEnvSuite that sometimes varies single derby instance standard

This is an automated email from the ASF dual-hosted git repository.

wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 503faa2  [SPARK-31715][SQL][TEST] Fix flaky SparkSQLEnvSuite that sometimes varies single derby instance standard
503faa2 is described below

commit 503faa24d33eb52da79ad99e39c8c011597499ea
Author: Kent Yao <ya...@hotmail.com>
AuthorDate: Fri May 15 06:36:34 2020 +0000

    [SPARK-31715][SQL][TEST] Fix flaky SparkSQLEnvSuite that sometimes varies single derby instance standard
    
    ### What changes were proposed in this pull request?
    
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/122622/testReport/junit/org.apache.spark.sql.hive.thriftserver/SparkSQLEnvSuite/SPARK_29604_external_listeners_should_be_initialized_with_Spark_classloader/history/?start=25
    
    According to the test report history of SparkSQLEnvSuiteļ¼Œthis test fails frequently which is caused by single derby instance restriction.
    
    ```java
    Caused by: sbt.ForkMain$ForkError: org.apache.derby.iapi.error.StandardException: Another instance of Derby may have already booted the database /home/jenkins/workspace/SparkPullRequestBuilder/sql/hive-thriftserver/metastore_db.
    	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown Source)
    	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown Source)
    	at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
    	at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
    	at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
    	at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
    	at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
    	at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
    	at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
    	at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
    	at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
    	at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
    	at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
    	at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown Source)
    	at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown Source)
    	at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown Source)
    	... 138 more
    ```
    
    This PR adds a separate directory to locate the metastore_db for this test which runs in a dedicated JVM.
    
    Besides, diable the UI for the potential race on `spark.ui.port` which may also let the test case become flaky.
    
    ### Why are the changes needed?
    test fix
    
    ### Does this PR introduce _any_ user-facing change?
    NO
    
    ### How was this patch tested?
    SparkSQLEnvSuite itself.
    
    Closes #28537 from yaooqinn/SPARK-31715.
    
    Authored-by: Kent Yao <ya...@hotmail.com>
    Signed-off-by: Wenchen Fan <we...@databricks.com>
---
 .../apache/spark/sql/hive/thriftserver/SparkSQLEnvSuite.scala  | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnvSuite.scala b/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnvSuite.scala
index ffd1fc4..f28faea 100644
--- a/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnvSuite.scala
+++ b/sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnvSuite.scala
@@ -17,6 +17,7 @@
 
 package org.apache.spark.sql.hive.thriftserver
 
+import org.apache.commons.io.FileUtils
 import test.custom.listener.{DummyQueryExecutionListener, DummyStreamingQueryListener}
 
 import org.apache.spark.SparkFunSuite
@@ -25,10 +26,19 @@ import org.apache.spark.sql.SparkSession
 import org.apache.spark.sql.hive.HiveUtils.{HIVE_METASTORE_JARS, HIVE_METASTORE_VERSION}
 import org.apache.spark.sql.hive.test.TestHiveContext
 import org.apache.spark.sql.internal.StaticSQLConf.{QUERY_EXECUTION_LISTENERS, STREAMING_QUERY_LISTENERS, WAREHOUSE_PATH}
+import org.apache.spark.util.Utils
 
 class SparkSQLEnvSuite extends SparkFunSuite {
   test("SPARK-29604 external listeners should be initialized with Spark classloader") {
+    val metastorePath = Utils.createTempDir("spark_derby")
+    FileUtils.forceDelete(metastorePath)
+
+    val jdbcUrl = s"jdbc:derby:;databaseName=$metastorePath;create=true"
+
     withSystemProperties(
+      "javax.jdo.option.ConnectionURL" -> jdbcUrl,
+      "derby.system.durability" -> "test",
+      "spark.ui.enabled" -> "false",
       QUERY_EXECUTION_LISTENERS.key -> classOf[DummyQueryExecutionListener].getCanonicalName,
       STREAMING_QUERY_LISTENERS.key -> classOf[DummyStreamingQueryListener].getCanonicalName,
       WAREHOUSE_PATH.key -> TestHiveContext.makeWarehouseDir().toURI.getPath,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org