Store "size" for s3-ambient adjuncts - #1220
Conversation
Returns all headers without reading full object
Used when calculating how to increment/decrement values when things are changed
Updated callsites that use Decrement to use new Adjust as more flexible
Captures possibility of s3Ambient -> external update leaving flag set
Maintains previous behaviour where s3 failure would still result in success, this is tolerant of failure to read header to get size. Possible failures reason would be a 404 manifesting as 403 if engine was missing s3:ListBucket permission
Edge case but found in testing, ensures we clear out previous size when incoming is a 0-byte adjunct.
Recent changes mean this can't be called for Adjuncts so remove bool
Load and update the ImageStorage record, rather than overwriting. Adjunct size is handled via different methods
|
Note As discussed internally with @tomcrane and @JackLewis-digirati , will merge this without review due to team annual leave. Confirming I used Claude Opus 4.8 for review, which noted a few issues that I resolved with last couple of commits. Issues spotted where
|
What does this change?
Fixes #1218
Resolves an issue where the "size" property wasn't stored for adjuncts that were ingested with S3-ambient strategy. This was a side-effect of the ingestion process being skipped, therefore the adjunct is never read. The solution is the HEAD the object to read the content-length.
An additional complexity was differentiating between the
adjunct.sizeproperty indicating that we store actual bytes. The existence of "origin" was used for this purpose but that no longer fits so I added a newoptimisedprop toadjunctentity. This is not reflected in the hydra model as it's internal only.The various properties are now
Adjunct.Size- this stores the provided size of the adjunct, or calculated size.Adjunct.Optimised- stores whether a hosted adjunct (it one with "origin") is at an optimised origin. If optimised = true, DLCS stores no bytes.CustomerStorage.AdjunctSize- accumulative size of all adjuncts for customer. This was correctly counting values but was being cleared on asset reingest.ImageStorage.TotalSizeOfStoredAssets- total size of all adjuncts across space/customer. On adjunct re-ingest this was double counting adjuncts size. This would have been resolved by recalc run but resolved while I was making changes.Database Migration
Note
Details of migration.
20260709152931_Add Optimised to adjunctsoptimisedtoadjunctstable, defaulting tofalse