Merge pull request #1068 from coreos-inc/slowqueryfix

Remove check for derived image storages on image storage
This commit is contained in:
josephschorr 2015-12-18 16:32:22 -05:00
commit 5ac7369bf5

View file

@ -29,12 +29,9 @@ def garbage_collect_storage(storage_id_whitelist):
return (select_base_query
.switch(ImageStorage)
.join(Image, JOIN_LEFT_OUTER)
.switch(ImageStorage)
.join(DerivedStorageForImage, JOIN_LEFT_OUTER,
on=(ImageStorage.id == DerivedStorageForImage.derivative))
.where(ImageStorage.id << list(candidates))
.group_by(*group_by)
.having((fn.Count(Image.id) == 0) & (fn.Count(DerivedStorageForImage.id) == 0)))
.having(fn.Count(Image.id) == 0))
# Note: Both of these deletes must occur in the same transaction (unfortunately) because a
# storage without any placement is invalid, and a placement cannot exist without a storage.