yuqi1129 opened a new pull request, #13600: URL: https://github.com/apache/gravitino/pull/13600
### What changes were proposed in this pull request? Use JDBC `Connection.isValid()` for MySQL pool validation instead of the cached `SELECT 1` prepared statement. Keep validation on borrow configurable and preserve the existing validation query for other databases. ### Why are the changes needed? With a MySQL URL that has no default database, switching catalogs makes the cached validation statement fail. DBCP then discards healthy connections and creates replacements on subsequent borrows. Fix: #13592 ### Does this PR introduce _any_ user-facing change? MySQL catalog connections are reused after switching catalogs, including when the JDBC URL has no default database. No API or configuration property changes. ### How was this patch tested? 87 tests passed across JDBC common and MySQL, including real MySQL tests for 100 sequential borrows and replacement of killed connections, with and without a default database. The reuse regression failed before the fix. MySQL URL variants and validation settings are covered. Spotless and Javadoc checks passed. ```bash ./gradlew spotlessApply :catalogs:catalog-jdbc-common:test :catalogs:catalog-jdbc-mysql:test :catalogs:catalog-jdbc-common:javadoc -PskipITs -PskipDockerTests=false ``` -- 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]
