mchades commented on code in PR #14023:
URL: https://github.com/apache/gravitino/pull/14023#discussion_r4344224217
##########
core/src/main/java/org/apache/gravitino/job/BuiltInJobTemplateEventListener.java:
##########
@@ -139,7 +140,14 @@ public void onPostEvent(Event postEvent) throws
RuntimeException {
return;
}
- reconcileBuiltInJobTemplates(metalakeName, builtInTemplates);
+ // This listener runs on an async dispatcher thread, which has no
caller principal. Run as
+ // the user who created the metalake, so the templates record that
user as the creator.
+ PrincipalUtils.doAs(
+ new UserPrincipal(event.user()),
+ () -> {
+ reconcileBuiltInJobTemplates(metalakeName, builtInTemplates);
Review Comment:
[P2] Resolve queued template registration by metalake identity
With async dispatch, the name from `CreateMetalakeEvent` can become stale.
On H2, pausing template loading after creating `a`, renaming it to `b`, then
resuming leaves `b` without built-in templates until restart
(`NoSuchMetalakeException`). Dropping `a` and recreating it as another user
instead lets the old event populate the replacement with the old creator.
Please reconcile against the original metalake's stable identity/current name
and ignore events for deleted instances.
--
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]