fix(thumbnails): two defects the copy test exposed
1. Per-file overrides must beat the content tier in RAM as well as on
disk. The content-keyed lookup ran first, so a thumbnail already
rendered from the file's content sat in RAM under content(blob_hash)
and shadowed a preview uploaded afterwards — permanently. Invisible
before the moka rekey, because both lived under one file-id key and
the upload simply overwrote the render. Order is now uniform:
per-file RAM, per-file disk (ext-), per-file DB, then content RAM,
blob-hash disk, derived blob.
2. store_attached_blob never wrote a row. Its RETURNING clause compared
the stored hash against EXCLUDED, and PostgreSQL only permits
EXCLUDED in the SET and WHERE of DO UPDATE — a runtime syntax error
on every call. The superseded hash now comes from a SELECT taken
before the upsert; losing that race leaves one stale reference, which
the manifest recompute reports, rather than anything being lost.
The second hid behind the first for a whole cycle, and behind
`ext-{file_id}.jpg`: the ORIGINAL kept serving its uploaded preview from
local disk, so the feature looked healthy. Only a copy, which has a
different file_id and therefore no ext- file, depends on the row — and
the row was never there. The handler's best-effort warn! completed the
disguise, so it is now error!: a failure there means copies silently
lose the preview, and nothing else signals it.
This commit is contained in:
@@ -768,11 +768,15 @@ impl FileHandler {
|
||||
)
|
||||
.await
|
||||
{
|
||||
tracing::warn!(
|
||||
// ERROR, not WARN: the sidecar keeps the feature looking healthy
|
||||
// on this box, so nothing else signals that copies are silently
|
||||
// losing the preview. A syntax error in the upsert hid behind a
|
||||
// warning for an entire test cycle exactly this way.
|
||||
tracing::error!(
|
||||
target: "oxicloud::dedup",
|
||||
error = %e,
|
||||
file_id = %id,
|
||||
"failed to record attached thumbnail; sidecar written, copies will not inherit it"
|
||||
"failed to record attached thumbnail; sidecar written, copies will NOT inherit it"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user