Merge branch 'master' of https://bitbucket.org/yackob03/quay
This commit is contained in:
commit
01fdfa079f
2 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
[loggers]
|
[loggers]
|
||||||
keys=root, gunicorn.error, gunicorn.access, application.profiler
|
keys=root, gunicorn.error, gunicorn.access, application.profiler, boto, werkzeug
|
||||||
|
|
||||||
[handlers]
|
[handlers]
|
||||||
keys=console
|
keys=console
|
||||||
|
|
|
@ -1394,6 +1394,13 @@ def garbage_collect_repository(namespace_name, repository_name):
|
||||||
logger.info('Cleaning up unreferenced images: %s', to_remove)
|
logger.info('Cleaning up unreferenced images: %s', to_remove)
|
||||||
Image.delete().where(Image.id << list(to_remove)).execute()
|
Image.delete().where(Image.id << list(to_remove)).execute()
|
||||||
|
|
||||||
|
if len(storage_id_whitelist) > 0:
|
||||||
|
garbage_collect_storage(storage_id_whitelist)
|
||||||
|
|
||||||
|
return len(to_remove)
|
||||||
|
|
||||||
|
|
||||||
|
def garbage_collect_storage(storage_id_whitelist):
|
||||||
# We are going to make the conscious decision to not delete image storage inside the transaction
|
# We are going to make the conscious decision to not delete image storage inside the transaction
|
||||||
# This may end up producing garbage in s3, trading off for higher availability in the database
|
# This may end up producing garbage in s3, trading off for higher availability in the database
|
||||||
def placements_query_to_paths_set(placements_query):
|
def placements_query_to_paths_set(placements_query):
|
||||||
|
@ -1411,6 +1418,7 @@ def garbage_collect_repository(namespace_name, repository_name):
|
||||||
.group_by(ImageStorage)
|
.group_by(ImageStorage)
|
||||||
.having((fn.Count(Image.id) == 0) & (fn.Count(DerivedImageStorage.id) == 0)))
|
.having((fn.Count(Image.id) == 0) & (fn.Count(DerivedImageStorage.id) == 0)))
|
||||||
|
|
||||||
|
logger.debug('Garbage collecting storage from candidates: %s', storage_id_whitelist)
|
||||||
with config.app_config['DB_TRANSACTION_FACTORY'](db):
|
with config.app_config['DB_TRANSACTION_FACTORY'](db):
|
||||||
# Find out which derived storages will be removed, and add them to the whitelist
|
# Find out which derived storages will be removed, and add them to the whitelist
|
||||||
orphaned_from_candidates = orphaned_storage_query(ImageStorage.select(), storage_id_whitelist)
|
orphaned_from_candidates = orphaned_storage_query(ImageStorage.select(), storage_id_whitelist)
|
||||||
|
|
Reference in a new issue