Roshan1299 opened a new pull request, #10627: URL: https://github.com/apache/gravitino/pull/10627
### What changes were proposed in this pull request? Reversed the cleanup order in `JobManager.cleanUpStagingDirs()` so the staging directory is deleted before the job entity record. Added a unit test to verify that when directory deletion fails, the entity record is preserved. ### Why are the changes needed? The previous order deleted the job entity first, then the staging directory. If `FileUtils.deleteDirectory()` failed with an `IOException`, the error was only logged. Since subsequent cleanup runs discover candidates via `entityStore.list()`, the orphaned staging directory became invisible and was left behind indefinitely. Fix: #10623 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Added `testCleanUpStagingDirsDeletesDirectoryBeforeEntity` which mocks `FileUtils.deleteDirectory` to throw `IOException` and verifies that `entityStore.delete` is never called. Existing `testCleanUpStagingDirs` also continues to pass. -- 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]
