From f59f4e51e805428d191abff408c32574542fcf74 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 16 Dec 2015 13:41:25 -0500 Subject: [PATCH] Remove check for derived image storages on image storage Derived image storages are now 1-to-1 with image storages, so we know they have already been removed at this point Fixes #1067 --- data/model/storage.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/data/model/storage.py b/data/model/storage.py index f144d157a..5f1cc572d 100644 --- a/data/model/storage.py +++ b/data/model/storage.py @@ -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.