Change garbage collection queries to be far smaller by GCing per tag and per image

While this will require far more iterations and queries, each query itself will be quite small, thus preventing us from locking up the database
This commit is contained in:
Joseph Schorr 2018-11-05 11:57:32 -05:00
parent d0e1f464ff
commit 5124422332
2 changed files with 31 additions and 33 deletions

View file

@ -508,10 +508,7 @@ def _delete_tags(repo, query_modifier=None):
.execute())
logger.debug('Removed %s tags with %s manifests', num_deleted_tags, num_deleted_manifests)
ancestors = reduce(lambda r, l: r | l,
(set(tag.image.ancestor_id_list()) for tag in tags_to_delete))
direct_referenced = {tag.image.id for tag in tags_to_delete}
return ancestors | direct_referenced
return [tag.image for tag in tags_to_delete]
def _get_repo_tag_image(tag_name, include_storage, modifier):