jerryshao opened a new issue, #13033: URL: https://github.com/apache/gravitino/issues/13033
### Version main branch ### Describe what's wrong `IcebergCatalogUtil` translates a failed JDBC connection into `ConnectionFailedException` by matching the exception message against the literal `Access denied` ([IcebergCatalogUtil.java#L188-L194](https://github.com/apache/gravitino/blob/main/iceberg/iceberg-common/src/main/java/org/apache/gravitino/iceberg/common/utils/IcebergCatalogUtil.java#L188-L194)): ```java } catch (UncheckedSQLException e) { Throwable cause = e.getCause(); if (cause instanceof SQLException && cause.getMessage() != null && cause.getMessage().contains("Access denied")) { throw new ConnectionFailedException(e, e.getMessage()); } ``` `Access denied for user '...'` is MySQL's wording (error 1045). PostgreSQL reports `FATAL: password authentication failed for user "..."` (SQLState `28P01`), and `FATAL: role "..." does not exist` (`28000`) for an unknown user. Neither contains `Access denied`, so a PostgreSQL-backed Iceberg JDBC catalog configured with bad credentials propagates the raw `UncheckedSQLException` instead of `ConnectionFailedException` — the caller sees a generic internal error, and catalog connection testing does not classify the failure as a connection problem. The same file already treats per-database message wording as something that must be enumerated: `isConcurrentViewMigrationConflict` documents and matches the MySQL, PostgreSQL *and* SQLite phrasings for the duplicate-column case. The credential check just above it was never given the same treatment. ### Error message and/or stacktrace Found by code inspection while auditing PostgreSQL support, not from a captured runtime failure, so I don't want to paste a fabricated trace. The shape is: `org.apache.iceberg.jdbc.UncheckedSQLException` wrapping `org.postgresql.util.PSQLException: FATAL: password authentication failed for user "gravitino"` (SQLState `28P01`), thrown out of `JdbcCatalog.initialize` and escaping unconverted. On MySQL the equivalent failure is correctly converted to `ConnectionFailedException`. ### How to reproduce 1. Gravitino `main` branch. 2. Create an Iceberg catalog with `catalog-backend=jdbc`, `uri=jdbc:postgresql://<host>:5432/<db>`, `jdbc-driver=org.postgresql.Driver`, and a deliberately wrong `jdbc-password`. 3. The failure surfaces as a generic runtime error rather than `ConnectionFailedException`. 4. Repeat with a MySQL `uri` and a wrong password — that path converts correctly, showing the asymmetry. ### Additional context Matching on SQLState rather than message text would be more robust and driver-locale-independent — PostgreSQL uses class `28` (`28P01`, `28000`) for invalid authorization, and MySQL's connector reports SQLState `28000` for error 1045, so a single `28` class check would cover both. Alternatively, extend the message matching to the PostgreSQL wordings, mirroring what `isConcurrentViewMigrationConflict` already does. -- 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]
