jerryshao commented on code in PR #14023:
URL: https://github.com/apache/gravitino/pull/14023#discussion_r4344285542
##########
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:
Fixed in bc7c931787. `onPostEvent` now captures the created metalake's id,
and the queued registration looks the metalake up by that id while holding the
root read lock (rename and drop take the root write lock), then reconciles
under its current name. A rename is followed, and a dropped metalake, including
one re-created under the same name by another user, is skipped.
`testRegistrationFollowsMetalakeRenamedWhileQueued` and
`testRegistrationSkipsMetalakeDroppedAndRecreatedWhileQueued` reproduce both
scenarios by blocking the template load; both fail against the previous head.
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
--
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]