nevzheng opened a new issue, #14272:
URL: https://github.com/apache/gravitino/issues/14272

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   In `GravitinoLanceNameSpaceOperations`, `dropNamespace` sends a one-level id 
to `dropCatalog`, which
   calls `namespaceWrapper.dropCatalog(catalogName, behavior == CASCADE)` 
without a scope check.
   
   Every other Lance namespace and table operation checks the catalog first with
   `loadAndValidateLakehouseCatalog` or `isLakehouseCatalog`: list, describe, 
exists, create, the schema
   operations, and all of `GravitinoLanceTableOperations`. For a Hive or 
Iceberg catalog, describe and
   exists return `NamespaceNotFoundException` ("Catalog is not a lakehouse 
catalog"), but drop goes through:
   
   - With `behavior=CASCADE`, the non-lakehouse catalog is dropped.
   - With the default `RESTRICT`, the request goes to 
`CatalogHookDispatcher.dropCatalog`, which removes
     the catalog's authorization plugin privileges before `CatalogManager` 
refuses the drop as in use. The
     client gets "Catalog <name> is in use", and the catalog has lost its 
plugin privileges.
   
   ### Error message and/or stacktrace
   
   `Catalog <name> is in use` for `RESTRICT`. Success for `CASCADE`.
   
   ### How to reproduce
   
   1. Start the Lance REST server against a metalake that has a Hive catalog 
`sales`.
   2. Lance `DescribeNamespace` with id `["sales"]` returns NamespaceNotFound.
   3. Lance `DropNamespace` with id `["sales"]` and `behavior=CASCADE`.
   
   Expected: NamespaceNotFound, as in step 2, and `sales` is unchanged.
   Actual: `sales` is dropped.
   
   ### Additional context
   
   Proposed fix: in the catalog-level drop, load the catalog and apply the same 
lakehouse check as describe
   before calling the backing drop.
   
   The privilege removal on a refused drop (the `RESTRICT` case) is a separate 
bug in
   `CatalogHookDispatcher.dropCatalog`, tracked in #14265. This issue covers 
only the Lance scope check.
   


-- 
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]

Reply via email to