Phase 3 of Appr migration
Deletes the old models and their code
This commit is contained in:
parent
223077ef53
commit
487edf0ba1
9 changed files with 218 additions and 167 deletions
|
@ -8,8 +8,8 @@ from data.model import (config, db_transaction, InvalidImageException, TorrentIn
|
|||
DataModelException, _basequery)
|
||||
from data.database import (ImageStorage, Image, ImageStoragePlacement, ImageStorageLocation,
|
||||
ImageStorageTransformation, ImageStorageSignature,
|
||||
ImageStorageSignatureKind, Repository, Namespace, TorrentInfo, Blob,
|
||||
ApprBlob, ensure_under_transaction)
|
||||
ImageStorageSignatureKind, Repository, Namespace, TorrentInfo, ApprBlob,
|
||||
ensure_under_transaction)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -105,21 +105,15 @@ def garbage_collect_storage(storage_id_whitelist):
|
|||
logger.warning('GC attempted to remove CAS checksums %s, which are still IS referenced',
|
||||
is_referenced_checksums)
|
||||
|
||||
# Check the ApprBlob tables as well.
|
||||
query = Blob.select(Blob.digest).where(Blob.digest << list(content_checksums))
|
||||
blob_referenced_checksums = set([blob.digest for blob in query])
|
||||
if blob_referenced_checksums:
|
||||
logger.warning('GC attempted to remove CAS checksums %s, which are still Blob referenced',
|
||||
blob_referenced_checksums)
|
||||
|
||||
# Check the ApprBlob table as well.
|
||||
query = ApprBlob.select(ApprBlob.digest).where(ApprBlob.digest << list(content_checksums))
|
||||
appr_blob_referenced_checksums = set([blob.digest for blob in query])
|
||||
if appr_blob_referenced_checksums:
|
||||
logger.warning('GC attempted to remove CAS checksums %s, which are ApprBlob referenced',
|
||||
appr_blob_referenced_checksums)
|
||||
|
||||
unreferenced_checksums = (content_checksums - blob_referenced_checksums -
|
||||
appr_blob_referenced_checksums - is_referenced_checksums)
|
||||
unreferenced_checksums = (content_checksums - appr_blob_referenced_checksums -
|
||||
is_referenced_checksums)
|
||||
|
||||
# Return all placements for all image storages found not at a CAS path or with a content
|
||||
# checksum that is referenced.
|
||||
|
|
Reference in a new issue