Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! Check difference of archive…
Browse files Browse the repository at this point in the history
… and bucket
  • Loading branch information
jvansanten committed Feb 16, 2024
1 parent 0eb903f commit 8619954
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions migrations/02_add_archive_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,20 @@
)

in_bucket = {summary.key: summary.size for summary in bucket.objects.all()}
print(f"{bucket.name}: {sum(in_bucket.values()) / 2**30:.1f} GB in {len(in_bucket)} items")
print(
f"{bucket.name}: {sum(in_bucket.values()) / 2**30:.1f} GB in {len(in_bucket)} items"
)
in_archive = {
get_key_for_url(bucket, row["uri"]): row["avro_archive_id"]
for row in connection.execute(sa.select([Archive.c.avro_archive_id, Archive.c.uri])).fetchall()
for row in connection.execute(
sa.select([Archive.c.avro_archive_id, Archive.c.uri]).where(
Archive.c.refcount > 0
)
).fetchall()
}
missing_in_bucket = sorted(in_archive[key] for key in set(in_archive.keys()).difference(in_bucket))
missing_in_bucket = sorted(
in_archive[key] for key in set(in_archive.keys()).difference(in_bucket)
)
missing_in_archive = [key for key in set(in_bucket).difference(in_archive)]
print(f"{len(missing_in_bucket)} missing in bucket: {missing_in_bucket}")
print(f"{len(missing_in_archive)} missing in archive {missing_in_archive}")

0 comments on commit 8619954

Please sign in to comment.