JoegenUSTC commented on code in PR #11705:
URL: https://github.com/apache/gravitino/pull/11705#discussion_r3426806415
##########
core/src/main/java/org/apache/gravitino/utils/IsolatedClassLoader.java:
##########
@@ -240,16 +240,23 @@ private boolean isSharedClass(String name) {
* @return true if the class is a catalog class, false otherwise.
*/
private boolean isCatalogClass(String name) {
- return name.startsWith("org.apache.gravitino.catalog")
- && (name.startsWith("org.apache.gravitino.catalog.hive.")
- || name.startsWith("org.apache.gravitino.catalog.lakehouse.")
- || name.startsWith("org.apache.gravitino.catalog.jdbc.")
- || name.startsWith("org.apache.gravitino.catalog.mysql.")
- || name.startsWith("org.apache.gravitino.catalog.postgresql.")
- || name.startsWith("org.apache.gravitino.catalog.doris.")
- || name.startsWith("org.apache.gravitino.catalog.fileset.")
- || name.startsWith("org.apache.gravitino.catalog.model.")
- || name.startsWith("org.apache.gravitino.catalog.kafka."));
+ // org.apache.gravitino.hive.* covers classes moved to the shared
hive-metastore-common
+ // module by the HiveClient refactoring (e.g. HiveExceptionConverter).
Without this prefix
+ // those classes are treated as shared and loaded by the server
classloader; their
+ // compiler-generated synthetic classes (e.g. $1 from switch-on-enum) are
then requested
+ // from the server classloader which cannot find them, causing a permanent
+ // NoClassDefFoundError that is cached by the JVM for the lifetime of the
process.
+ return name.startsWith("org.apache.gravitino.hive.")
+ || (name.startsWith("org.apache.gravitino.catalog")
+ && (name.startsWith("org.apache.gravitino.catalog.hive.")
Review Comment:
@diqiu50
Thanks for the review! You're right — the outer
name.startsWith("org.apache.gravitino.catalog") is indeed redundant since every
inner sub-prefix (e.g. org.apache.gravitino.catalog.hive.) already implies it.
I've removed the wrapping AND and flattened the conditions into a
straightforward OR chain. The semantics remain identical.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]