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

   ### **What changes were proposed in this pull request?**
   Standardized dispatcher wiring so that all object types follow the 
Hook(Event(Normalize(Manager))) pattern, matching the existing 
Policy/AccessControl wiring. This ensures CREATE events are published before 
SET_OWNER events for all object types.
   
   GravitinoEnv: Flipped wiring for Metalake, Catalog, Schema, Table, Fileset, 
Topic, Model, Tag, Job dispatchers.
   RESTService: Flipped wiring for Iceberg Table, View, Namespace dispatchers.
   HookDispatchers: Ensured setOwner failures are gracefully handled via 
try-catch-log so that ownership failure does not cause creation failure.
   
   ### **Why are the changes needed?**
   Currently, most object types wrap HookDispatcher inside EventDispatcher 
(Event(Hook(Manager))). Since HookDispatcher auto-sets the creator as owner 
after creation, the SET_OWNER event is published before the CREATE event. This 
results in non-causal event ordering — external consumers see SET_OWNER for an 
object that hasn't been "created" yet from the event stream's perspective.
   
   Policy already uses the correct pattern where HookDispatcher wraps 
EventDispatcher. This PR standardizes all object types to match.
   
   **Fix**: #10713
   
   ### **Does this PR introduce any user-facing change?**
   No. This is an internal event ordering fix. The API behavior is unchanged. 
Events are now published in causal order (CREATE before SET_OWNER).
   
   ### **How was this patch tested?**
   Added setOwner-failure unit tests for all affected HookDispatchers to verify 
that creation succeeds even when setOwner throws:
   
   Core (10 tests): TestMetalakeHookDispatcher, TestSchemaHookDispatcher, 
TestTableHookDispatcher, TestFilesetHookDispatcher, TestTopicHookDispatcher, 
TestModelHookDispatcher, TestTagHookDispatcher, TestPolicyHookDispatcher, 
TestAccessControlHookDispatcher, TestJobHookDispatcher
   
   Iceberg (3 tests): TestIcebergTableHookDispatcher, 
TestIcebergViewHookDispatcher, TestIcebergNamespaceHookDispatcher
   
   Tested in Gravitino dev environment. All core and iceberg tests pass:
   
   
   `./gradlew :core:test :iceberg:iceberg-rest-server:test -PskipITs`
   


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