feat(scheduler): Drop completed job runs as they complete

Before this change, upon the completion of a job run, the scheduler
would update a job_run entry with the completed status as well as the
number of objects affected by the run. Additionally, we then had a
cleaner job whose scope was deleting these completed entries from
job_run.

This commit changes this design to drop the cleaner job the and rolls
its functionality directly into the scheduler. Now, when any given job
run is complete, the scheduler will automatically delete it from the
job_run table itself.

In addition, the completed status has been removed as a valid status as
it is not set anymore.

This change follows a decision that given the data in these job_run
entries is already being deleted by the cleaner job, updating its state
when a job completes just to have it deleted is not efficient.
Additionally, no use-case for this data was surfaced.
This commit is contained in:
Hugo committed 2024-11-05 17:10:39 +00:00
1 parent 62c41191ff
commit 27c432a748
17 files changed
+120 -282

No files matched your search

-4
View File
@@ -45,7 +45,6 @@ import (
"github.com/hashicorp/boundary/internal/ratelimit"
"github.com/hashicorp/boundary/internal/recording"
"github.com/hashicorp/boundary/internal/scheduler"
"github.com/hashicorp/boundary/internal/scheduler/cleaner"
"github.com/hashicorp/boundary/internal/scheduler/job"
"github.com/hashicorp/boundary/internal/server"
serversjob "github.com/hashicorp/boundary/internal/server/job"
@@ -637,9 +636,6 @@ func (c *Controller) registerJobs() error {
if err := kmsjob.RegisterJobs(c.baseContext, c.scheduler, c.kms); err != nil {
return err
}
if err := cleaner.RegisterJob(c.baseContext, c.scheduler, rw); err != nil {
return err
}
if err := snapshot.RegisterJob(c.baseContext, c.scheduler, rw, rw); err != nil {
return err
}