amalsaidov opened a new pull request, #14867:
URL: https://github.com/apache/gravitino/pull/14867
### What changes were proposed in this pull request?
During catalog initialization, `getAndCheckCatalogStorageLocations` checks
named `location-*` paths with `fs.exists` / `getFileStatus`. An `IOException`
there was wrapped in a plain `RuntimeException` via `ExceptionMessages.wrap`.
This PR throws `ConnectionFailedException` for these storage-access failures
instead, identifying the failing location and preserving the underlying
cause.
### Why are the changes needed?
For a Fileset catalog with named locations,
`POST /api/metalakes/{metalake}/catalogs/testConnection` returned HTTP 500 /
code 1002 for invalid storage credentials, instead of the connection-failed
result (HTTP 200 / code 1007). The failure happens during initialization,
before the per-location probe and failure classification run, so the generic
`RuntimeException` was surfaced as an internal error.
`ConnectionFailedException` is mapped by `handleTestConnectionException` to
the
connection-failed response, matching the behavior of the per-location probe.
Related to the initialization gap noted alongside #14819.
Fixes #14844
### Does this PR introduce _any_ user-facing change?
Yes. `testConnection` (and catalog creation) now report storage-access
failures encountered while checking named catalog locations as connection
failures (code 1007) rather than internal errors (code 1002), and the message
identifies the failing location.
### How was this patch tested?
- Added `testInitializeReportsStorageAccessFailureAsConnectionFailure`, which
stubs a named location's filesystem to deny access and asserts a
`ConnectionFailedException` identifying the location is thrown during
`initialize`.
- `./gradlew :catalogs:catalog-fileset:spotlessCheck
:catalogs:catalog-fileset:test --tests
"org.apache.gravitino.catalog.fileset.TestFilesetCatalogOperations.testInitializeReportsStorageAccessFailureAsConnectionFailure"`
— BUILD SUCCESSFUL.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]