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

   ### What changes were proposed in this pull request?
   
   Add the opt-in `gravitino.enableSessionCatalogShadowing` catalog store 
option.
   
   - `GravitinoSessionCatalogStore`: when shadowing is enabled, `contains()` 
reports a Gravitino catalog that the session has not accessed as absent, so 
Flink can create a session catalog under its name. Gravitino catalogs that the 
session loaded through `getCatalog()` or created through `storeCatalog()` are 
tracked and keep the existing behavior, so `DROP`/`ALTER CATALOG` on them still 
reach Gravitino. A warning is logged when a session catalog shadows a Gravitino 
catalog.
   - Gravitino-managed catalog types are rejected under the name of an existing 
Gravitino catalog before the catalog is registered. Flink 1.20.0 stores a 
catalog before instantiating it, so `storeCatalog()` rejects it; Flink 1.19, 
2.1, and 2.2 instantiate it first, so `FactoryUtils#createCatalogFactoryHelper` 
rejects it. The store passes the name to the factory through a thread-local 
that is set only by `contains()` and cleared by every other store call and by 
the factory check.
   - `GravitinoCatalogStoreFactory` validates that the option is only enabled 
with `enableSessionCatalogSupport=true`, before creating the Gravitino client.
   - Docs: option table and a new "Let session catalogs shadow Gravitino 
catalogs" section with the exact behavior and limitations.
   
   ### Why are the changes needed?
   
   `excludedCatalogs` needs the conflicting names in advance. Set per job, 
every existing job needs a configuration change; set cluster-wide, it hides the 
Gravitino catalogs from all jobs. This option needs no names and only affects 
jobs that explicitly create a same-named session catalog.
   
   Fix: #15073
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. New property 
`table.catalog-store.gravitino.gravitino.enableSessionCatalogShadowing` 
(boolean, default `false`). Behavior is unchanged unless it is enabled.
   
   ### How was this patch tested?
   
   - Unit tests in `TestGravitinoSessionCatalogStore`, 
`TestGravitinoCatalogStoreFactory`, and `TestFactoryUtils`.
   - `TestGravitinoSessionCatalogStoreWithCatalogManager` runs against a real 
Flink `TableEnvironment`/`CatalogManager` in the Flink 1.19, 1.20, 2.1, and 2.2 
modules: create/duplicate create/use/alter/describe/drop of the shadowing 
catalog, drop of accessed and unaccessed Gravitino catalogs, Gravitino-managed 
type rejection before registration, recovery after a failed creation, and 
`CREATE CATALOG IF NOT EXISTS`.
   - `FlinkSupportsSessionCatalogIT` (Flink 1.19 and 1.20, real Gravitino 
server and Hive): shadowing lifecycle, Gravitino catalog unchanged and visible 
to other sessions, Gravitino-managed type rejected, unaccessed Gravitino 
catalog never dropped.
   - `./gradlew :flink-connector:flink-{common,1.19,1.20,2.1,2.2}:build 
-PskipITs` and the full Flink 1.20 IT suite with `-PskipDockerTests=false`.
   


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