roryqi opened a new issue, #13326:
URL: https://github.com/apache/gravitino/issues/13326
### Version
main branch
### Describe what's wrong
For an externally managed table, such as a JDBC table, the table can exist
in the underlying catalog and be loadable through the table API, but `GET
/api/metalakes/{metalake}/objects/table/{fullName}/roles` may return
`NoSuchMetadataObjectException` before the table has been loaded/imported into
Gravitino's entity store.
After loading the same table through the table API, the roles API returns
200 with an empty role list.
### Error message and/or stacktrace
The roles API returns 404 with `NoSuchMetadataObjectException`, for example:
```json
{
"code": 1003,
"type": "NoSuchMetadataObjectException",
"message": "Failed to operate role operation [LIST] under metalake [...],
reason [Metadata object ... (type TABLE) doesn't exist]"
}
```
### How to reproduce
1. Use a catalog with externally managed tables, such as a JDBC catalog.
2. Pick a table that exists in the underlying catalog but has not yet been
loaded/imported into Gravitino's entity store.
3. Call:
```text
GET /api/metalakes/{metalake}/objects/table/{catalog}.{schema}.{table}/roles
```
4. Observe that the API returns `NoSuchMetadataObjectException`.
5. Load the same table:
```text
GET
/api/metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/tables/{table}
```
6. Call the roles API again.
7. Observe that it returns 200 with an empty role list.
### Additional context
The roles API currently queries role bindings through the entity-store
relation path. If the table has not been imported yet, the local `table_meta`
row may not exist even though the table exists in the underlying catalog.
The roles API should check/resolve the metadata object before listing role
bindings, consistent with other object-related APIs.
--
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]