Commit graph

3 commits

Author SHA1 Message Date
mateo-berri
bfdaedf51b fix(proxy-extras): take the repair schema from DATABASE_URL and deploy the real-migration test on a fresh database 2026-09-02 16:23:50 -07:00
mateo-berri
2d64020d43 fix(proxy-extras): run the index repair over DIRECT_URL and exercise it through a real migrate deploy 2026-09-02 15:24:42 -07:00
mateo-berri
55c7872496 fix(proxy-extras): rebuild indexes left INVALID by a migration deadlock
Two replicas racing prisma migrate deploy can deadlock, and the loser dies
mid CREATE INDEX CONCURRENTLY, leaving the index INVALID. The retried
migration's IF NOT EXISTS then skips it, so the planner never uses it.

After migrations succeed, look for INVALID indexes on LiteLLM tables and
have one replica (advisory try-lock) REINDEX INDEX CONCURRENTLY each of
them, dropping _ccnew/_ccold leftovers of an interrupted rebuild instead.
The repair never blocks startup: a failed rebuild is logged and retried
on the next boot. Also encode DATABASE_URL query values with quote instead
of quote_plus so options=-c%20... reaches psycopg intact.
2026-09-02 12:57:06 -07:00