Repository navigation
fix(proxy-extras): stop the migration sanity check from building the hand-built SpendLogs indexes and cut 1.103.3 - #44286
Merged
Conversation
… the hand-built SpendLogs indexes schema.prisma still declares the LiteLLM_SpendLogs (api_key, startTime) and (litellm_call_id) indexes while their migrations are now SELECT 1, so the v1 resolver's drift script recreated both with a blocking CREATE INDEX at boot. The drift script now drops those two statements before it is applied, matching filter_request_log_index_diff on main. The key metadata recovery fixture builds its index directly and the schema sync test exempts the two indexes.
Contributor
|
|
|
||
| class TestResolveAllMigrationsLedger: | ||
| def _run(self, monkeypatch, tmp_path, partitioned, execute_fails): | ||
| def _run(self, monkeypatch, tmp_path, partitioned, execute_fails, drift_sql=_PARTITIONED_DRIFT_SQL): |
Contributor
There was a problem hiding this comment.
The new drift_sql parameter and test parameters lack types. AGENTS.md requires strongly typed parameters. Add these types before merging
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
yucheng-berri
approved these changes
Oct 3, 2026
4 of 6 tasks
DeoLeung
pushed a commit
to aiyou178/litellm
that referenced
this pull request
Oct 4, 2026
… the hand-built SpendLogs indexes schema.prisma still declares the LiteLLM_SpendLogs (api_key, startTime) and (litellm_call_id) indexes while their migrations are now SELECT 1, so the v1 resolver's drift script recreated both with a blocking CREATE INDEX at boot. The drift script now drops those two statements before it is applied, matching filter_request_log_index_diff on main. The schema sync test exempts the two indexes Ported to rc/1.104.0 from stable/1.103.x (BerriAI#44286), which is not on main: main carries filter_request_log_index_diff from BerriAI#43948 instead, and its backport here was reverted in BerriAI#44212. The key metadata recovery hunk is dropped because this line's test file has no Postgres-backed index fixture (cherry picked from commit 4d245e1)
3 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
SELECT 1litellmwas still 1.103.2, which is already publishedHow it solves it:
CREATE INDEXstatementsfilter_request_log_index_diffon main, so 1.105 convergeslitellmto 1.103.3;litellm-proxy-extrasstays at the unpublished 0.4.100.post1User Flow
Before: an operator upgrading from a pre-1.103 release still gets both SpendLogs indexes built at proxy boot, holding a write-blocking lock on a large table
DATABASE_URLpointing at a database last migrated by 1.102CREATE INDEXforLiteLLM_SpendLogs_litellm_call_id_idxandLiteLLM_SpendLogs_api_key_startTime_idx, blocking spend log writes until both finishAfter: the same upgrade boots without touching those indexes, so the operator builds them online on their own schedule
DATABASE_URLCREATE INDEX CONCURRENTLYby hand when readyScreenshots / Proof of Fix
Shared setup: a throwaway
postgres:16withlog_statement=all, one database per run, seeded byprisma migrate deploywith every migration older than20260823000000(the state a 1.102 proxy leaves behind) plus 5 SpendLogs rows. Each run boots the proxy's DB setup with no server:Before (3e32c0c)
up_before: exit 0, log showsCREATE INDEX "LiteLLM_SpendLogs_..._idx"statementsAfter (21995f8)
up_after: exit 0, log showsCREATE INDEXfor either indextests/proxy_migration_tests/test_db_schema_migration.pyalso passes against an empty database on this branch; it failed on 3e32c0c with exactly these twoCREATE INDEXstatements as the driftType
🐛 Bug Fix
Caveats (if any)
Medium
request_id OR litellm_call_idspend log lookups get slower without them--use_prisma_db_pushlikely still builds both fromschema.prisma, blocking (untested; db push syncs to the schema)Low
Pre-Submission checklist