jerryshao commented on code in PR #14016:
URL: https://github.com/apache/gravitino/pull/14016#discussion_r4332888650
##########
core/src/main/java/org/apache/gravitino/job/JobManager.java:
##########
@@ -1363,6 +1349,53 @@ private Optional<JobEntity> updateJobEntity(
}
}
+ private void cleanUpStagingDirs(String metalake) {
+ long now = System.currentTimeMillis();
+ List<JobEntity> expiredJobs = new ArrayList<>();
+ for (JobEntity job : listJobs(metalake, Optional.empty())) {
+ if (isFinishedStatus(job.status())) {
+ if (job.finishedAt() > 0 && job.finishedAt() +
jobStagingDirKeepTimeInMs < now) {
Review Comment:
Left as is, since `finishedAt` can't be null for a `JobEntity` that reaches
this loop:
- `JobEntity.FINISHED_AT` is `Field.required`, and `Builder.build()` calls
`validate()`, which throws `IllegalArgumentException` for a null required field
(`Field.validate`).
- `JobPO`'s constructor rejects a null `jobFinishedAt`
(`Preconditions.checkArgument(jobFinishedAt != null, ...)`), and `fromJobPO` is
the only path from storage.
- The column is `job_finished_at BIGINT ... NOT NULL DEFAULT 0`.
An unfinished job is stored with `0`, which the `> 0` check already treats
as "not finished".
_🤖 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]