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

   ### What would you like to be improved?
   
                                                                                
                                                                                
                                                                                
                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                        
   ### What would you like to be improved?                                      
                                                                                
                                                                                
                                     
                                                                                
                                                                                
                                                                                
                                     
   PR #11188 introduced internal dispatchers for Iceberg REST internal metadata 
synchronization paths to avoid emitting duplicate or misleading user-visible 
events/audit logs.                                                              
                                        
                                                                                
                                                                                
                                                                                
                                     
   Within the Iceberg REST scope, internal operations such as catalog lookup, 
schema/table/view import, and owner synchronization should not be recorded as 
standalone user API events. For example, when a user creates a table through 
Iceberg REST, Gravitino should record the   
   user-visible Iceberg REST operation, but should not additionally emit 
internal `load schema`, `load table`, or `set owner` events caused by metadata 
synchronization.                                                                
                                               
                                                                                
                                                                                
                                                                                
                                     
   While reviewing PR #11188, we noticed there may be similar internal 
dispatcher usages outside the Iceberg REST path. These usages may also produce 
extra events/audit logs even though they are infrastructure/helper operations 
rather than direct user API operations.          
                                                                                
                                                                                
                                                                                
                                     
   Potential areas to audit include:                                            
                                                                                
                                                                                
                                     
                                                                                
                                                                                
                                                                                
                                     
   - Authorization helper logic, for example metadata lookups in 
`AuthorizationUtils`                                                            
                                                                                
                                                    
   - Ranger authorization plugin helper logic that loads catalogs/tables while 
translating or updating policies                                                
                                                                                
                                      
   - Dispatcher implementations that internally load dependent metadata, for 
example schema lookup inside topic operations                                   
                                                                                
                                        
   - Any other infrastructure code that calls normal event/hook dispatchers for 
internal metadata lookup or synchronization                                     
                                                                                
                                     
                                                                                
                                                                                
                                                                                
                                     
   This issue tracks a follow-up audit and cleanup so that internal operations 
consistently use internal/no-event dispatchers where appropriate.               
                                                                                
                                      
                                                                                
                                                                                
                                                                                
                                     
   ### How should we improve?                                                   
                                                                                
                                                                                
                                     
                                                                                
                                                                                
                                                                                
                                     
   We should audit internal dispatcher usages and classify them into two 
categories:                                                                     
                                                                                
                                            
                                                                                
                                                                                
                                                                                
                                     
   1. User-visible API operations                                               
                                                                                
                                                                                
                                     
      These should continue using normal hook/event dispatchers so that events, 
authorization hooks, and audit logs are emitted as expected.                    
                                                                                
                                     
                                                                                
                                                                                
                                                                                
                                     
   2. Infrastructure/internal helper operations                                 
                                                                                
                                                                                
                                     
      These should use internal dispatchers that preserve normalization and 
core metadata behavior but skip hooks and event emission.                       
                                                                                
                                         
                                                                                
                                                                                
                                                                                
                                     
   A possible implementation plan:                                              
                                                                                
                                                                                
                                     
                                                                                
                                                                                
                                                                                
                                     
   - Review usages of `GravitinoEnv.getInstance().catalogDispatcher()`, 
`schemaDispatcher()`, `tableDispatcher()`, `viewDispatcher()`, 
`ownerDispatcher()`, and similar event-enabled dispatchers outside REST 
endpoint handlers and hook dispatchers.                               
   - Identify calls that are only used for internal metadata lookup, 
synchronization, policy translation, authorization helper logic, or 
cache/bootstrap flows.                                                          
                                                            
   - For each confirmed internal path, switch to an appropriate internal 
dispatcher, such as:                                                            
                                                                                
                                            
     - `internalCatalogDispatcher()`                                            
                                                                                
                                                                                
                                     
     - `internalSchemaDispatcher()`                                             
                                                                                
                                                                                
                                     
     - `internalTableDispatcher()`                                              
                                                                                
                                                                                
                                     
     - `internalViewDispatcher()`                                               
                                                                                
                                                                                
                                     
     - `internalOwnerDispatcher()`                                              
                                                                                
                                                                                
                                     
     - `internalAccessControlDispatcher()`                                      
                                                                                
                                                                                
                                     
   - Add missing internal dispatchers only when there is a clear internal use 
case and the event semantics are well understood.                               
                                                                                
                                       
   - Add unit tests to verify that internal paths do not call the normal 
event-enabled dispatcher.                                                       
                                                                                
                                            
   - Be conservative for authorization/Ranger-related paths, because changing 
dispatcher behavior there may affect authorization plugin side effects. These 
should be reviewed case by case.                                                
                                         
                                                                                
                                                                                
                                                                                
                                     
   This should be handled separately from PR #11188 to keep that PR focused on 
Iceberg REST duplicate audit/event cleanup.        
   
   ### How should we improve?
   
   _No response_


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