geyanggang commented on issue #14756:
URL: https://github.com/apache/gravitino/issues/14756#issuecomment-6765581185

   Thanks for the detailed report. I verified this against upstream with Flink 
1.20 (real `TableEnvironment`/`CatalogManager`, Gravitino store mocked).
   
   **Findings**
   - It reproduces upstream, and it isn't Paimon-specific. `CREATE CATALOG` on 
a name that exists in Gravitino fails with exactly the reported message. 
`CatalogManager#createCatalog` checks `catalogStore.contains(name)` first, and 
`GravitinoSessionCatalogStore#contains` returns `memory || gravitino`.
   - The message format (`ignoreIfExists: [false]`, `Catalog <name> already 
exists.`) is from Flink 1.20+, not 1.18. Could you update the environment 
section with the actual Flink version?
   - Session-local shadowing can't be done consistently in the store layer 
alone. Flink uses the same `contains()` for create (must be false), and for 
drop/alter (must be true). Making it memory-only lets create succeed, but `DROP 
CATALOG` on a Gravitino-only catalog then fails with `does not exist`.
   
   **Proposal**
   
   Add an explicit, opt-in per-session exclusion list instead of implicit 
shadowing, e.g. 
`table.catalog-store.gravitino.gravitino.session.excluded-catalogs` (name open 
for discussion):
   - Valid only when `enableSessionCatalogSupport=true`; fail fast otherwise.
   - Listed names are never resolved against Gravitino in that session 
(`contains`/`getCatalog`/`listCatalogs`/`removeCatalog` only consult the 
in-memory store), so create/use/alter/drop all target the native catalog.
   - `DROP CATALOG` never touches Gravitino metadata for listed names.
   - Creating a Gravitino-managed catalog type under a listed name is rejected 
with a clear error.
   - Default is empty, so existing behavior doesn't change. It adds no new 
access path: session catalog support already allows native catalogs, and those 
use their own authn/authz rather than Gravitino's. The docs should state this 
explicitly.
   
   I prototyped this on Flink 1.20, and 
create/duplicate-create/use/alter/describe/drop/show all behave consistently, 
while Gravitino-only catalogs are unaffected.
   
   Separately, the docs say "if a catalog with the same name exists in both 
stores, the in-memory entry takes precedence", but creating such a catalog via 
SQL is rejected today. That statement should be corrected as part of the change.
   
   If this direction looks good to you, would you like to open a PR for it? 
Please include tests against a real `CatalogManager` covering create/drop/alter 
for both excluded and Gravitino-only catalogs. If you don't have the bandwidth, 
just let me know and I'm happy to pick it 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]

Reply via email to