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

   # [Improvement] Avoid full Hive table loads during repeated privilege 
existence checks
   
   ### What would you like to be improved?
   
   A permission synchronizer may grant or revoke privileges for many roles on 
the same Hive table. Each privilege request validates the metadata object, even 
when the table has already been imported and its source identity has not 
changed. Currently, that validation performs a complete table load rather than 
a lightweight live-source identity check.
   
   On Apache Gravitino main `98c65decb42dd00e9bfebdc77edc90fba59b18d0`, the 
path is:
   
   `PermissionOperations` → `MetadataObjectUtil.checkMetadataObject` → 
`TableOperationDispatcher.tableExists` → the default `TableCatalog.tableExists` 
→ `loadTable` / `loadAndImportTable`.
   
   The dispatcher loads the connector table and performs 
registration/column-refresh work. For Hive, full loading materializes table 
metadata; Hive 3 also loads column constraints, and SerDe-derived schemas can 
require field resolution. Repeating permission operations for an unchanged 
table repeats work unrelated to the requested existence check. This can amplify 
metastore and metadata-store work during bulk permission synchronization.
   
   This is distinct from authorization ID-cache lookups: the extra load occurs 
in the metadata-object existence check itself. Existing issue #15133 concerns 
the former path.
   
   A focused regression on an already registered table reproduced the behavior: 
`tableExists` called the connector's full `loadTable` once instead of using a 
lightweight source-identifier probe. The regression fails on the unmodified 
dispatcher with Mockito reporting that exact full-load interaction. This is a 
call-path reproduction, not a throughput benchmark or a claim that all 
synchronization latency is caused here.
   
   ### How should we improve?
   
   Consider an optional connector SPI that reads a live table's Gravitino 
identifier without resolving columns, constraints or SerDe schemas. Hive can 
implement it using a single raw HMS table lookup. The lookup must reject views 
and propagate metastore failures.
   
   For an already imported, externally managed table whose source identifier 
still matches, an existence check can use that result without loading or 
refreshing the full table metadata. Sources without a persistent identifier 
must retain their existing name-based identity semantics.
   
   Keep the full load/import path for unregistered tables, changed or malformed 
identifiers, managed catalogs and connectors without the optional SPI. In 
particular, do not simply replace the current dispatcher path with a boolean 
connector `tableExists`: the original path also imports external tables and 
checks their identity, which permission writes depend on. Do not cache 
existence across requests or bypass endpoint/version checks.
   
   Tests should cover the repeated imported-table path, first import, source 
deletion, same-name replacement/changed identifiers, views, missing 
identifiers, metastore failures and legacy/managed connectors. Hive 2 and Hive 
3 tests should assert that the probe performs no field-resolution or 
column-constraint RPCs.
   


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