yuqi1129 opened a new pull request, #13855: URL: https://github.com/apache/gravitino/pull/13855
### What changes were proposed in this pull request? Before the create-time backend probe looks up its driver, `JdbcCatalogOperations.probeConnection` now loads and initializes the class named in `jdbc-driver`. It uses the catalog's class loader, so the driver registers itself with `DriverManager` before `getDriver()` runs. That class loader is also the one `DriverManager` checks the caller against. ### Why are the changes needed? When the driver ships only in the catalog's `libs` directory, as with ClickHouse, the probe fails with `No suitable driver`. Such a driver registers with `DriverManager` only when its class is initialized. Nothing does that before the probe: - The pool loads the driver lazily. - `DataSourceUtils.verifyDriverPresent` loads the class without initializing it. Fix: #13854 ### Does this PR introduce _any_ user-facing change? No API or property change. Catalogs whose driver ships only in the catalog libs can be created again with create-time verification enabled. ### How was this patch tested? - New `TestJdbcCatalogOperationsProbe#testProbeFindsDriverVisibleOnlyToCatalogClassLoader`. It runs the probe from an isolated class loader against a driver that self-registers on class initialization and has no `META-INF/services` entry. Without the fix it fails with `No suitable driver`; with the fix it passes. - Unit tests pass for catalog-jdbc-common, catalog-jdbc-clickhouse, catalog-jdbc-mysql and catalog-jdbc-postgresql with `-PskipITs`. -- 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]
