nevzheng opened a new issue, #14269:
URL: https://github.com/apache/gravitino/issues/14269
### Version
main branch
### Describe what's wrong
When a Hive catalog uses the Ranger HDFS plugin (directly or in a `chain`),
dropping the catalog does
not remove the policy on its warehouse path. Two things combine:
- **The HDFS plugin ignores catalog removals.**
`RangerAuthorizationHDFSPlugin#removeMetadataObject`
does nothing for `CATALOG` (the same branch as `METALAKE`), so even a
correct list of locations
removes nothing.
- **A failed location lookup looks like "no locations".**
`AuthorizationUtils#getMetadataObjectLocation`
logs any exception and returns an empty list.
`CatalogHookDispatcher#dropCatalog` passes that list
to the plugin, which cannot tell it apart from a catalog without
locations, removes nothing and
reports success. The catalog is then deleted.
So the Gravitino-managed policy items on the catalog's path outlive the
catalog. A new catalog, schema
or table created on the same path picks them up, and nothing cleans them up
later.
### Error message and/or stacktrace
None. The drop returns `true`. A failed lookup only logs
`Failed to get location paths for metadata object ... type CATALOG`.
### How to reproduce
1. Enable authorization. Create a Hive catalog `c` with
`authorization-provider=ranger`, Ranger service
type `HDFS`, and grant a role privileges that create a Ranger HDFS policy
on the catalog's warehouse
path.
2. `DELETE /api/metalakes/m/catalogs/c?force=true`.
3. Reload the HDFS policies in Ranger.
Expected: the Gravitino-managed items of the policy on the catalog's path
are removed.
Actual: the policy is unchanged.
Variant: if the location lookup fails during the drop (for example the
metastore is unreachable), the
drop still succeeds and the policy stays.
### Additional context
Proposed fix:
- Remove the catalog path policy in the HDFS plugin, but keep it when
another Hive catalog in the same
metalake uses the same path.
- Let location lookup report failure separately from "no locations", and
refuse the drop before any
plugin call when a plugin needs locations that could not be looked up.
--
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]