You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the #6445 reindex, 2.6M records landed in three consecutive id-minter windows. All three executions failed (one Lambda timeout, two OOMs), and window mode has no backfill, so the records were silently skipped until manually replayed. wellcomecollection/catalogue-pipeline#3524 added a manual replay lever and wellcomecollection/catalogue-pipeline#3527 fixed lookup throughput (roughly 16x), but the structure is unchanged: one Lambda processes a whole window serially, the 15-minute schedule cadence and the 900s Lambda timeout are essentially the same number so there is no headroom band, and a failed window is still skipped silently. #6328 framed the same options before the Python port.
Approach
Reuse the image inferrer's find_work pattern (wellcomecollection/catalogue-pipeline#3413): a small discovery Lambda scans the source index for ids in the window, partitions them to S3 (pass-by-reference, keeping the Step Functions payload under the 256 KB limit), and a Map state fans out workers with bounded concurrency. Rather than copying it, generalise it so both consumers share one implementation:
Python: extract a generic find-and-partition core; the inferrer and id-minter keep thin per-service entrypoints, built as separate Lambdas from the unified image so IAM and ES credentials stay scoped per service.
Terraform: a shared state machine module owning the ConstructEvent input guards, the find-work Lambda, the Map skeleton with MaxConcurrency, post-Map failure aggregation, alarms and the schedule. The per-service worker block (ECS runTask for the inferrer, lambda:invoke for the id-minter) is injected by the caller, since the two share almost nothing.
For the id-minter specifically: MaxConcurrency is pinned to the RDS budget (the measured sweet spot during the #6445 recovery was 6), partitions are sized by work count (~10k works keeps worst-case identifier density well inside the Lambda timeout at post-#3527 throughput), and failed partitions fail the execution rather than being tolerated, because unlike the inferrer no later window re-covers a missed indexed_at range. Concurrent minting is already safe: FOR UPDATE SKIP LOCKED plus the FOR SHARE race detection, exercised 6-wide during the recovery.
Context
During the #6445 reindex, 2.6M records landed in three consecutive id-minter windows. All three executions failed (one Lambda timeout, two OOMs), and window mode has no backfill, so the records were silently skipped until manually replayed. wellcomecollection/catalogue-pipeline#3524 added a manual replay lever and wellcomecollection/catalogue-pipeline#3527 fixed lookup throughput (roughly 16x), but the structure is unchanged: one Lambda processes a whole window serially, the 15-minute schedule cadence and the 900s Lambda timeout are essentially the same number so there is no headroom band, and a failed window is still skipped silently. #6328 framed the same options before the Python port.
Approach
Reuse the image inferrer's find_work pattern (wellcomecollection/catalogue-pipeline#3413): a small discovery Lambda scans the source index for ids in the window, partitions them to S3 (pass-by-reference, keeping the Step Functions payload under the 256 KB limit), and a Map state fans out workers with bounded concurrency. Rather than copying it, generalise it so both consumers share one implementation:
For the id-minter specifically: MaxConcurrency is pinned to the RDS budget (the measured sweet spot during the #6445 recovery was 6), partitions are sized by work count (~10k works keeps worst-case identifier density well inside the Lambda timeout at post-#3527 throughput), and failed partitions fail the execution rather than being tolerated, because unlike the inferrer no later window re-covers a missed indexed_at range. Concurrent minting is already safe: FOR UPDATE SKIP LOCKED plus the FOR SHARE race detection, exercised 6-wide during the recovery.
Phases
Both phases need a manual terraform apply per pipeline date.