mirror of
https://github.com/minio/minio.git
synced 2025-01-23 12:43:16 -05:00
Handle zero versions qualified for expiration (#19301)
When objects have more versions than their ILM policy expects to retain via NewerNoncurrentVersions, but they don't qualify for expiry due to NoncurrentDays are configured in that rule. In this case, applyNewerNoncurrentVersionsLimit method was enqueuing empty tasks, which lead to a panic (panic: runtime error: index out of range [0] with length 0) in newerNoncurrentTask.OpHash method, which assumes the task to contain at least one version to expire.
This commit is contained in:
parent
9370b11684
commit
383489d5d9
@ -233,6 +233,10 @@ func (es *expiryState) enqueueByDays(oi ObjectInfo, event lifecycle.Event, src l
|
||||
// enqueueByNewerNoncurrent enqueues object versions expired by
|
||||
// NewerNoncurrentVersions limit for expiry.
|
||||
func (es *expiryState) enqueueByNewerNoncurrent(bucket string, versions []ObjectToDelete, lcEvent lifecycle.Event) {
|
||||
if len(versions) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
task := newerNoncurrentTask{bucket: bucket, versions: versions, event: lcEvent}
|
||||
wrkr := es.getWorkerCh(task.OpHash())
|
||||
if wrkr == nil {
|
||||
|
@ -1051,7 +1051,9 @@ func (i *scannerItem) applyNewerNoncurrentVersionLimit(ctx context.Context, _ Ob
|
||||
})
|
||||
}
|
||||
|
||||
expState.enqueueByNewerNoncurrent(i.bucket, toDel, event)
|
||||
if len(toDel) > 0 {
|
||||
expState.enqueueByNewerNoncurrent(i.bucket, toDel, event)
|
||||
}
|
||||
return objectInfos, nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user