Files
tazlin 6c12cf8743 fix: worker speed zero-average fallback
- Align speed materialization with runtime behavior by treating an average performance of 0 like no samples and falling back to the worker baseline, preventing downstream division-by-zero on speed reads.
- Add an index on worker_performances.worker_id in the model and migration path to avoid repeated full-table scans during backfill and ongoing performance updates.
- Refactor 5.0.4 SQL rollout guidance, and add temporary insert-trigger scaffolding for mixed 5.0.3/5.0.4 fleets with a follow-up cleanup script.
- Add unit tests covering zero-average fallback and recovery once nonzero samples arrive.
2026-07-23 15:38:55 -04:00

12 lines
466 B
Plaintext

-- Removes the rollout scaffolding added by 5.0.4.txt.
--
-- Run only once no 5.0.3 instance remains in the fleet. A 5.0.3 worker registration
-- omits the speed column, and once this trigger is gone that INSERT fails against the
-- NOT NULL constraint. Until then the trigger is also what keeps a rollback to 5.0.3
-- viable.
SET lock_timeout = '3s';
DROP TRIGGER IF EXISTS workers_speed_baseline_trg ON workers;
DROP FUNCTION IF EXISTS workers_speed_baseline();