nevzheng opened a new pull request, #14273:
URL: https://github.com/apache/gravitino/pull/14273

   ### What changes were proposed in this pull request?
   
   - **`GravitinoLanceNameSpaceOperations.dropCatalog`** now loads the catalog 
and applies the lakehouse
     scope check before calling the backing `dropCatalog`. A non-lakehouse 
catalog is refused with the same
     `NamespaceNotFoundException` ("Catalog is not a lakehouse catalog: 
<name>") that describe and exists
     return, and the backing drop is never called.
   - A missing catalog keeps its current handling (`FAIL` gives "Catalog not 
found", `SKIP` succeeds) and
     is no longer passed to the backing drop.
   - **`GravitinoLanceNamespaceWrapper`:** the check in 
`loadAndValidateLakehouseCatalog` moves into a
     package-private `validateLakehouseCatalog`, so both paths throw the same 
error.
   
   ### Why are the changes needed?
   
   **The catalog-level drop was the only Lance operation without the lakehouse 
scope check.** A Lance client
   could drop any catalog in the metalake, Hive or Iceberg included, although 
Lance cannot list or describe
   those catalogs. The default `RESTRICT` request also reached the catalog 
hook's privilege cleanup before
   the drop was refused as in use (that ordering is fixed separately in #14265).
   
   Fix: #14272
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Lance `DropNamespace` on a one-level id that names a non-lakehouse 
catalog now returns
   NamespaceNotFound (404) in every mode and behavior, and the catalog is left 
unchanged. Lakehouse
   catalogs and missing catalogs behave as before.
   
   ### How was this patch tested?
   
   New cases in `TestGravitinoLanceNameSpaceOperations`, with a real wrapper 
over a stubbed
   `CatalogOperator`, so the production scope check runs:
   
   - **Refused:** non-lakehouse catalog with no behavior, `RESTRICT` and 
`CASCADE`; every non-lakehouse
     kind (Iceberg, MySQL, fileset, and the `lakehouse-generic` provider on the 
wrong type); `SKIP` mode;
     the error matches describe.
   - **Guards:** a lakehouse catalog still drops (`RESTRICT` → `force=false`, 
`CASCADE` → `true`); a
     lakehouse catalog in use keeps its error; a missing catalog keeps its 
behavior.
   
   Results:
   
   - **On `main`:** 10 of the 17 `TestGravitinoLanceNameSpaceOperations` cases 
fail (the non-lakehouse catalog is dropped); the 7 guards pass.
   - **With the fix:** all 17 pass, as do the other Lance tests in 
`lance-common` and `lance-rest-server` (`TestGravitinoLanceNamespaceWrapper`, 
`TestGravitinoLanceTableOperations` and others).
   
   `./gradlew -PskipITs :lance:lance-common:test :lance:lance-rest-server:test 
--tests 'org.apache.gravitino.lance.*'`
   


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