-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-32909][SQL] Pass all sql/hive-thriftserver
module UTs in Scala 2.13
#29783
Conversation
@@ -31,6 +31,7 @@ class HiveMetastoreLazyInitializationSuite extends SparkFunSuite { | |||
.config("spark.hadoop.hive.metastore.uris", "thrift://127.0.0.1:11111") | |||
.getOrCreate() | |||
val originalLevel = org.apache.log4j.Logger.getRootLogger().getLevel | |||
val originalClassLoader = Thread.currentThread().getContextClassLoader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @srowen I think this change is very Interesting, HiveThriftServer2ListenerSuite
will ABORTED without this change
HiveThriftServer2ListenerSuite:
*** RUN ABORTED ***
java.lang.LinkageError: loader constraint violation: loader (instance of net/bytebuddy/dynamic/loading/MultipleParentClassLoader) previously initiated loading for a different type with name "org/apache/hive/service/ServiceStateChangeListener"
The Context Class Loader is NonClosableMutableURLClassLoader
in HiveMetastoreLazyInitializationSuite
running process and propagate to HiveThriftServer2ListenerSuite
, then
Lines 172 to 175 in 92b75dc
if (live) { | |
val server = mock(classOf[HiveThriftServer2], RETURNS_SMART_NULLS) | |
val listener = new HiveThriftServer2Listener(kvstore, sparkConf, Some(server)) | |
(new HiveThriftServer2AppStatusStore(kvstore, Some(listener)), listener) |
will use MultipleParentClassLoader(NonClosableMutableURLClassLoader and AppClassLoader)
to mock HiveThriftServer2
instance in Scala 2.13, but mock HiveThriftServer2
instance use AppClassLoader
only in Scala 2.12.
Then I do some experiments:
-
Ignore
HiveMetastoreLazyInitializationSuite
all tests passed -
Run
HiveThriftServer2ListenerSuite
only will passed -
Copy test case
HiveMetastoreLazyInitializationSuite
toHiveThriftServer2ListenerSuite
then runHiveThriftServer2ListenerSuite
only, it aborted in both Scala 2.12 and Scala 2.13.
I guess that HiveMetastoreLazyInitializationSuite
and HiveThriftServer2ListenerSuite
run in same thread in Scala 2.13 but different thread in Scala 2.12, but I don't know why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for investigation, @LuciferYang . It's interesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I think it's fine, as this change just improves isolation in any event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya. I agree with @srowen . The patch itself looks good.
Test build #128811 has finished for PR 29783 at commit
|
sql/hive-thriftserver
module UTs in Scala 2.13sql/hive-thriftserver
module UTs in Scala 2.13
Retest this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I triggered JDK11 testing too because this is a class loader related issue, @LuciferYang .
Test build #128831 has finished for PR 29783 at commit
|
Thank you, @LuciferYang and @srowen . |
sql/hive-thriftserver
module UTs in Scala 2.13sql/hive-thriftserver
module UTs in Scala 2.13
Thank @srowen and @dongjoon-hyun ~ |
What changes were proposed in this pull request?
This pr fix failed and aborted cases in sql hive-thriftserver module in Scala 2.13, the main change of this pr as follow:
Use
s.c.Seq
instead ofSeq
inHiveResult
because the input type maybemutable.ArraySeq
, butSeq
representimmutable.Seq
in Scala 2.13.Reset classLoader after
HiveMetastoreLazyInitializationSuite
completed because context class loader isNonClosableMutableURLClassLoader
inHiveMetastoreLazyInitializationSuite
running process, and it propagate toHiveThriftServer2ListenerSuite
trigger following problems in Scala 2.13:After this pr
HiveThriftServer2Suites
andHiveThriftServer2ListenerSuite
was fixed and all 461 test passedWhy are the changes needed?
We need to support a Scala 2.13 build.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Scala 2.12: Pass the Jenkins or GitHub Action
Scala 2.13: All tests passed.
Do the following:
Before
After