mirror of
https://github.com/pgsty/minio.git
synced 2026-11-10 09:35:31 +03:00
fix(batch): do not run a completed expire job again
BatchJobExpire.Start checked the job's submitter before it looked at the job's report, and refuse() clears Complete. A job that had completed was therefore turned into a failed one on the next start: one that completed before the upgrade records no submitter, and one completed with a temporary credential that has expired since, a deleted user or a changed password fails the binding. Such a job asked to be submitted again, inviting an operator to run a destructive expiration twice. Return before the submitter check when the report says the job is complete, as replication and key rotation jobs already do. Tests: a completed job without a submitter, and a completed job whose temporary credential expired, keep their completed state and delete nothing when started again; a job that did not complete is still refused once its credential expired. The first two fail without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -641,6 +641,12 @@ func (r *BatchJobExpire) Start(ctx context.Context, api ObjectLayer, job BatchJo
|
||||
if err := ri.loadOrInit(ctx, api, job); err != nil {
|
||||
return err
|
||||
}
|
||||
// A completed job is not run again, as replication and key rotation
|
||||
// jobs are not: its submitter is not checked again either, so a
|
||||
// credential that expired since cannot turn it into a failed job.
|
||||
if ri.Complete {
|
||||
return nil
|
||||
}
|
||||
if done, err := ri.startAuthorized(ctx, api, job); done || err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user