feat(dates): backfill drain converts mixed-convention rows to true instants (#118)
Per-tick drain (backfill_utc_dates) at the existing date-drain seam, inside the per-library online gate. Selects date_utc IS NULL AND date_taken IS NOT NULL (new partial index idx_image_exif_utc_backfill), re-runs resolve_dates_batch with empty priors (one exiftool subprocess per batch, same call shape as the #117 audit), and writes only the new-contract triple; the legacy pair stays frozen. Capped by DATE_BACKFILL_MAX_PER_TICK; missing-file rows are paged past without spending the cap. Legacy manual overrides convert via manual_date_resolution rather than being re-resolved from the file. Day-boundary invalidation deletes the day-span precomputed reels covering a re-dated row's old/new display-zone month-day so the nightly pre-gen regenerates them. Progress: imageserver_date_backfill_remaining gauge + date_backfill_remaining on GET /libraries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ab16bc7da6
commit
98db2a48db
11 files changed
+1185
-4
No files matched your search
@@ -460,6 +460,10 @@ pub struct LibraryStatus {
|
||||
#[serde(flatten)]
|
||||
pub library: Library,
|
||||
pub health: LibraryHealth,
|
||||
/// Rows in this library not yet converted to the true-instant date
|
||||
/// contract (`date_utc IS NULL`, ADR-0001 / ticket #118). Drains to 0
|
||||
/// over watcher ticks; `None` when the count query failed.
|
||||
pub date_backfill_remaining: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
@@ -488,6 +492,12 @@ pub async fn list_libraries(_claims: Claims, app_state: Data<AppState>) -> impl
|
||||
.library_health
|
||||
.read()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
let context = opentelemetry::Context::new();
|
||||
let mut exif_dao = app_state
|
||||
.insight_generator
|
||||
.exif_dao()
|
||||
.lock()
|
||||
.expect("Unable to lock ExifDao");
|
||||
let libraries = live_guard
|
||||
.iter()
|
||||
.map(|lib| LibraryStatus {
|
||||
@@ -496,6 +506,11 @@ pub async fn list_libraries(_claims: Claims, app_state: Data<AppState>) -> impl
|
||||
.get(&lib.id)
|
||||
.cloned()
|
||||
.unwrap_or(LibraryHealth::Online),
|
||||
// Live count off the partial index — cheap, and exact even for
|
||||
// a stale library the watcher isn't refreshing.
|
||||
date_backfill_remaining: exif_dao
|
||||
.count_rows_needing_utc_backfill(&context, lib.id)
|
||||
.ok(),
|
||||
})
|
||||
.collect();
|
||||
HttpResponse::Ok().json(LibrariesResponse {
|
||||
|
||||
Reference in new issue
Block a user