Enhancements to daily-sweeper routine to reduce CPU load (#8209)

- ListObjectsHeal should list only objects
  which need healing, not the entire namespace.
- DeleteObjects() to be used to delete 1000s of
  objects in bulk instead of serially.
This commit is contained in:
Harshavardhana
2019-09-10 12:08:44 -07:00
committed by kannappanr
parent 432cb38dbd
commit e12f52e2c6
3 changed files with 29 additions and 31 deletions

View File

@@ -139,22 +139,24 @@ func lifecycleRound(ctx context.Context, objAPI ObjectLayer) error {
if err != nil {
continue
}
var objects []string
for _, obj := range res.Objects {
// Find the action that need to be executed
action := l.ComputeAction(obj.Name, obj.ModTime)
switch action {
case lifecycle.DeleteAction:
objAPI.DeleteObject(ctx, bucket.Name, obj.Name)
objects = append(objects, obj.Name)
default:
// Nothing
// Do nothing, for now.
}
}
// Deletes a list of objects.
objAPI.DeleteObjects(ctx, bucket.Name, objects)
if !res.IsTruncated {
// We are done here, proceed to next bucket.
break
} else {
marker = res.NextMarker
}
marker = res.NextMarker
}
}