27 lines
973 B
Plaintext
27 lines
973 B
Plaintext
=== ТРЕК 2: Согласованность S3 и PostgreSQL ===
|
|
|
|
[1] Исходное состояние (всё синхронизировано):
|
|
Total records in DB: 1
|
|
Orphan objects (in S3, not in DB): 0
|
|
Missing objects (in DB, not in S3): 0
|
|
|
|
[2] Создаем Orphan object (загружаем файл в S3 в обход API):
|
|
docker compose exec api python -c "... s3.put_object(..., Key='garbage_file.png', ...)"
|
|
(Файл garbage_file.png загружен в бакет)
|
|
|
|
[3] Запускаем проверку (Dry-run):
|
|
Total objects in S3: 2
|
|
Total records in DB: 1
|
|
Orphan objects (in S3, not in DB): 1
|
|
[ORPHANS] (Safe to delete, no metadata in DB):
|
|
- garbage_file.png
|
|
|
|
[4] Запускаем исправление (--fix):
|
|
[FIX] Deleting orphan objects from S3...
|
|
Deleted garbage_file.png
|
|
|
|
[5] Финальная проверка:
|
|
Total objects in S3: 1
|
|
Total records in DB: 1
|
|
Orphan objects (in S3, not in DB): 0
|
|
Missing objects (in DB, not in S3): 0 |