acoustic-carpenter-78188
07/10/2026, 8:40 PMTaskActions), the executor's reconcile throughput collapsed and runs wedged under overload. Root cause: every reconcile that changed status blocked synchronously on eventsClient.Record, which became a single-row INSERT per event. At scale this pegged all reconcile workers (~2s each during the completion burst), so newly-created actions were starved of a worker and their pods were created 30+ minutes late.
Notably it is not commit-amplification, CPU throttling, or DB write saturation (all ruled out by measurement): the DB insert itself is <100ms. The cost was flush/worker starvation on the synchronous per-event path.
What changes were proposed in this pull request?
Two changes that make a reconcile cheap at scale (both keep semantics unchanged):
1. Batched event writes (event_batcher.go, wired in taskaction_controller.go): a small batcher coalesces concurrent reconciles' `ActionEvent`s into a few multi-event Record RPCs. Each caller still blocks until its batch commits, so delivery is unchanged (at-least-once): on error the reconcile requeues and re-emits, and re-emission is idempotent via the existing ON CONFLICT DO NOTHING. Flush concurrency is bounded independently of reconcile fan-out.
2. Multi-row InsertEvents (runs/repository/impl/action.go): a batch becomes one multi-row INSERT (one transaction/commit) instead of one commit per event.
Plus a small related optimization:
3. Skip the cache-hit Catalog.Get for already-RUNNING actions (taskaction_cache.go): a cache hit is moot mid-execution, so this avoids a redundant blocking cache-service RPC on every reconcile of a held action. The serializable-reservation heartbeat is preserved.
How was this patch tested?
• Unit tests added: event_batcher_test.go (coalescing delivers every event exactly once, batch cap respected, errors propagate, context-cancel unblocks — run with -race); taskaction_cache_test.go (running actions skip Get). Existing InsertEvents tests pass against real Postgres (multi-row path).
• End-to-end on a 40k-held benchmark (dev cluster): per-reconcile event-write latency dropped from ~1980ms (p50) to <300ms with zero slow reconciles through the completion burst; server-side inserts stayed <100ms. Runs stopped wedging on the control plane.
Labels
fixed
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
flyteorg/flyteacoustic-carpenter-78188
07/10/2026, 8:40 PM