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

   ### What would you like to be improved?
   
   Currently, the dispatcher chain for most object types (Catalog, Schema, 
Table, Fileset, Topic, Model, Tag, Metalake, Job) wraps the HookDispatcher 
inside the EventDispatcher:
   
   `EventDispatcher → NormalizeDispatcher → HookDispatcher → Manager`
   The HookDispatcher auto-sets the creator as the object owner after creation. 
Because the EventDispatcher is the outermost layer, the SET_OWNER event 
(triggered by the hook) is published before the `CREATE` event. This results in 
non-causal event ordering -- For our external sync service, the consumers see 
`SET_OWNER` for an object that hasn't been "created" yet from the event 
stream's perspective.
   
   In contrast, Policy already use the correct pattern where HookDispatcher 
wraps EventDispatcher:
   
   `HookDispatcher → EventDispatcher → Manager`
   This guarantees CREATE events are published before `SET_OWNER` events.
   
   Additionally, most HookDispatcher implementations (except 
`CatalogHookDispatcher`) lack rollback logic. If setOwner fails after a 
successful create, the object is left orphaned with no owner and no cleanup.
   
   ### How should we improve?
   
   Standardize dispatcher wiring in GravitinoEnv.java so that all object types 
follow the `Hook(Event(Normalize(Manager)))` pattern, matching the existing 
Policy/AccessControl wiring. This ensures `CREATE` events are always published 
before `SET_OWNER` events.
   
   Add rollback logic to `HookDispatcher` implementations that lack it (Schema, 
Table, Fileset, Topic, Model, Tag, AccessControl, Job), following the pattern 
already established in `CatalogHookDispatcher` -- if setOwner fails after 
creation, drop the object and propagate the exception.
   
   These changes affect `GravitinoEnv.java` (wiring order) and the individual 
*HookDispatcher classes (rollback). No interface changes are required.


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