Ayushman-Gaur opened a new pull request, #10297:
URL: https://github.com/apache/gravitino/pull/10297

   1. Title: [#10271] fix(job): cancel submitted job execution when entity 
store persistence fails in runJob
    
   ### What changes were proposed in this pull request?
   
   Added rollback compensation logic in `JobManager.runJob()`. 
   If `entityStore.put()` fails after `jobExecutor.submitJob()` succeeds, 
   the submitted job execution is now cancelled via 
`jobExecutor.cancelJob(jobExecutionId)` 
   before rethrowing the original exception. Rollback success and failure are 
both logged.
   
   ### Why are the changes needed?
   
   Previously, if entityStore.put() threw an IOException, the method would 
   rethrow but leave the already-submitted job running with no persisted 
record. 
   
   Fix: #10271
   
   ### Does this PR introduce _any_ user-facing change?
   
   No user-facing changes. This is an internal failure-handling improvement.
   
   ### How was this patch tested?
   
   Added unit test `testRunJobShouldCancelSubmittedJobWhenStorePutFails` 
   in `JobManagerTest.java` that:
   - Mocks entityStore.put() to throw IOException
   - Verifies that jobExecutor.cancelJob() is called exactly once with 
     the correct jobExecutionId
   - Verifies that RuntimeException is still thrown to the caller
   


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