JoegenUSTC opened a new pull request, #11707:
URL: https://github.com/apache/gravitino/pull/11707

   ### What changes were proposed in this pull request?
   
   Replace the `switch`-on-enum with `if`-`else` in
   `HiveCatalogCapability.caseSensitiveOnName()`, and add unit tests to
   verify both the functional behavior and the absence of the synthetic
   `$1` class in the compiled output.
   
   ### Why are the changes needed?
   
   Fix: #11706
   
   `SchemaNormalizeDispatcher` calls `caseSensitiveOnName()` **after**
   `IsolatedClassLoader.withClassLoader()` exits — i.e. outside the catalog's
   isolated classloader context. The `switch`-on-enum causes the Java compiler
   to generate a synthetic helper class `HiveCatalogCapability$1`. In certain
   classloader initialization timing windows, the server classloader is involved
   in loading `$1` but cannot find it in the server classpath. **The JVM
   permanently caches this load failure for the process lifetime**, causing all
   subsequent calls to throw `NoClassDefFoundError` until restart.
   
   Replacing `switch` with `if`-`else` using `==` on enum constants compiles to
   `if_acmpeq` (reference comparison) with no synthetic class dependency, making
   `caseSensitiveOnName()` safe to call from any classloader context.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. The method behavior is identical; only the compiled representation 
changes.
   
   ### How was this patch tested?
   
   Added `TestHiveCatalogCapability` with three test methods:
   - Case-insensitive scopes (`SCHEMA`, `TABLE`, `COLUMN`) return `unsupported`
   - Case-sensitive scopes (`FILESET`, `TOPIC`, `PARTITION`, `MODEL`) return 
`supported`
   - `HiveCatalogCapability$1` does not exist in the compiled output
     (guards against future regression back to `switch`)


-- 
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]

Reply via email to