Try to fix the bad query that makes mysql a sad panda.
This commit is contained in:
parent
f4642be11a
commit
57dc1e045a
1 changed files with 14 additions and 13 deletions
|
@ -1034,20 +1034,21 @@ def garbage_collect_repository(namespace_name, repository_name):
|
||||||
|
|
||||||
image_to_remove.delete_instance()
|
image_to_remove.delete_instance()
|
||||||
|
|
||||||
storage_to_remove = (ImageStorage
|
if uuids_to_check_for_gc:
|
||||||
.select()
|
storage_to_remove = (ImageStorage
|
||||||
.join(Image, JOIN_LEFT_OUTER)
|
.select()
|
||||||
.group_by(ImageStorage)
|
.join(Image, JOIN_LEFT_OUTER)
|
||||||
.where(ImageStorage.uuid << list(uuids_to_check_for_gc))
|
.group_by(ImageStorage)
|
||||||
.having(fn.Count(Image.id) == 0))
|
.where(ImageStorage.uuid << list(uuids_to_check_for_gc))
|
||||||
|
.having(fn.Count(Image.id) == 0))
|
||||||
|
|
||||||
for storage in storage_to_remove:
|
for storage in storage_to_remove:
|
||||||
logger.debug('Garbage collecting image storage: %s', storage.uuid)
|
logger.debug('Garbage collecting image storage: %s', storage.uuid)
|
||||||
storage.delete_instance()
|
storage.delete_instance()
|
||||||
image_path = store.image_path(namespace_name, repository_name,
|
image_path = store.image_path(namespace_name, repository_name,
|
||||||
image_to_remove.docker_image_id,
|
image_to_remove.docker_image_id,
|
||||||
storage.uuid)
|
storage.uuid)
|
||||||
store.remove(image_path)
|
store.remove(image_path)
|
||||||
|
|
||||||
return len(to_remove)
|
return len(to_remove)
|
||||||
|
|
||||||
|
|
Reference in a new issue