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

   ### What changes were proposed in this pull request?
   
   When ownership is enabled, TMS cron/commit `submitAndBind` runs `runJob` as 
the metalake owner USER via `PrincipalUtils.doAs`, so `JobManager` can set a 
real job owner instead of `anonymous`.
   
   `TableMaintenanceRESTFeature` resolves `jobOperationDispatcher` and 
`internalOwnerDispatcher` from `GravitinoEnv` and passes them into 
`MaintenanceJobManager.getInstance(...)`.
   
   When ownership is disabled (`internalOwnerDispatcher` is null), behavior is 
unchanged because `JobManager` already skips `setOwner`.
   
   ### Why are the changes needed?
   
   Scheduler threads have no authenticated subject. 
`JobManager.registerAndSubmit` then sets the job owner to `anonymous`. If that 
user does not exist in the metalake, TMS submit fails and no maintenance job 
runs.
   
   Fixes #14999
   
   ### Does this PR introduce _any_ user-facing change?
   
   No API change. TMS background jobs are owned by the metalake owner user when 
ownership is enabled.
   
   ### How was this patch tested?
   
   - `./gradlew :plugins:maintenance:compileJava :plugins:maintenance:test 
-PskipITs -PskipDockerTests=true`
   
   Made with [Cursor](https://cursor.com)


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