Reconcile attachment metadata with the bucket in one merge pass
StorageReconciler walks the sorted bucket listing and keyset pages of attachments ordered by object key side by side, so a pass is linear and keeps one page of each side in memory. An object without a row is deleted only when it is older than grace plus skew and a lookup by key right before the delete still finds no row; a ready row whose object is missing, has another size or, with the deep check, another digest is put in quarantine after a HEAD recheck and is never deleted; a stale intent is claimed with SKIP LOCKED and dropped object first; a quarantined row whose object matches again is released. Deep checks hash objects in a bounded task group, each action uses its own unit of work, and failures of single actions are counted instead of aborting. An advisory lock lets one pass run at a time. Content of a quarantined attachment answers 404 without touching S3, its metadata is unchanged. The storage port gains listing pages and HEAD, the repository keyset pages, lookup by key, claim and quarantine marking; the platform logger can write to another stream. The one-off entry point python -m messenger.attachments.entrypoints.reconcile is a dry run unless --apply is given, assembles the adapters with the API key of S3 and prints a JSON report with counts per class, samples and the cost of the pass to stdout while the journal goes to stderr. Tests run the reconciler against its own migrated database with every class, apply and repeat, the row that appears after the listing, the busy lock and the release, and check paged byte-order listing and HEAD against RustFS. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
62986245a2
commit
91731fd317
@@ -5,18 +5,18 @@
|
||||
|
||||
## 2. Зона `attachments`: домен и приложение
|
||||
|
||||
- [ ] 2.1 Домен: `Quarantine`, поле `quarantine` агрегата
|
||||
- [ ] 2.2 Порты: `StoredObject`, `ObjectStorage.listing/stat`, `AttachmentRepository.page_after/by_key/claim/mark`, `SingleRun`; команда `ReconcileStorage`
|
||||
- [ ] 2.3 `StorageReconciler`: слияние потоков, классы, повторные проверки, действия, `--deep` под ограничением, отчёт `Reconciliation`
|
||||
- [ ] 2.4 `OpenAttachment`: карантин → `404` без S3
|
||||
- [ ] 2.5 Проверка группы: `make lint`
|
||||
- [x] 2.1 Домен: `Quarantine`, поле `quarantine` агрегата
|
||||
- [x] 2.2 Порты: `StoredObject`, `ObjectStorage.listing/stat`, `AttachmentRepository.page_after/by_key/claim/mark`, `SingleRun`; команда `ReconcileStorage`
|
||||
- [x] 2.3 `StorageReconciler`: слияние потоков, классы, повторные проверки, действия, `--deep` под ограничением, отчёт `Reconciliation`
|
||||
- [x] 2.4 `OpenAttachment`: карантин → `404` без S3
|
||||
- [x] 2.5 Проверка группы: `make lint`
|
||||
|
||||
## 3. Зона `attachments`: адаптеры и точка входа
|
||||
|
||||
- [ ] 3.1 Адаптер S3: листинг страницами, `HEAD`; адаптер PostgreSQL: колонка карантина, keyset, по ключу, `SKIP LOCKED`, `UPDATE` карантина, `PostgresSingleRun`
|
||||
- [ ] 3.2 Платформа: поток журнала настраивается
|
||||
- [ ] 3.3 CLI `messenger.attachments.entrypoints.reconcile`: флаги, сборка адаптеров, JSON в stdout, коды выхода
|
||||
- [ ] 3.4 Проверка группы: API-тесты сверки против одноразового PostgreSQL (каждый класс в dry-run без изменений, apply и повтор = 0, свежее и используемое сохранены, строка появилась после листинга, карантин и `404`, `healed`, `--deep`, занятая блокировка); тест адаптера против RustFS (порядок листинга, страницы, `HEAD`)
|
||||
- [x] 3.1 Адаптер S3: листинг страницами, `HEAD`; адаптер PostgreSQL: колонка карантина, keyset, по ключу, `SKIP LOCKED`, `UPDATE` карантина, `PostgresSingleRun`
|
||||
- [x] 3.2 Платформа: поток журнала настраивается
|
||||
- [x] 3.3 CLI `messenger.attachments.entrypoints.reconcile`: флаги, сборка адаптеров, JSON в stdout, коды выхода
|
||||
- [x] 3.4 Проверка группы: API-тесты сверки против одноразового PostgreSQL (каждый класс в dry-run без изменений, apply и повтор = 0, свежее и используемое сохранены, строка появилась после листинга, карантин и `404`, `healed`, `--deep`, занятая блокировка); тест адаптера против RustFS (порядок листинга, страницы, `HEAD`)
|
||||
|
||||
## 4. Стенд
|
||||
|
||||
|
||||
Reference in New Issue
Block a user