revert(spend-logs): drop the endTime backfill migration for spend log timestamps - #37875
Merged
yuneng-berri merged 2 commits intoAug 21, 2026
Conversation
… timestamps Reverts #37554, which added 20260819000000_backfill_spend_log_timestamps
…itellm_/revert-pr-37554-migration-5af8ea
Contributor
Greptile SummaryThis PR removes the spend-log timestamp backfill migration so upgrades no longer rewrite the entire historical spend-log table during startup.
Confidence Score: 5/5The PR appears safe to merge because the removed data-only backfill avoids the documented startup timeout while its timestamp tradeoff is explicit. The remaining timestamp behavior is intentionally documented, and the deleted migration’s equal timestamp does not trigger the custom resolver’s strictly-newer applied-migration check.
|
| Filename | Overview |
|---|---|
| litellm-proxy-extras/litellm_proxy_extras/migrations/20260819000000_backfill_spend_log_timestamps/migration.sql | Deletes the unbounded historical timestamp backfill; no concrete unacknowledged correctness or migration-resolution failure was established. |
Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/lit..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ryan-crabbe-berri
previously approved these changes
Aug 21, 2026
ryan-crabbe-berri
approved these changes
Aug 21, 2026
yucheng-berri
approved these changes
Aug 21, 2026
yuneng-berri
merged commit Aug 21, 2026
f6c19ea
into
litellm_internal_staging
70 of 72 checks passed
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:
How it solves it:
User Flow
Before: an operator upgrading a gateway that has a large spend history watches the deploy fail, and nothing in the failure names the size of their data as the cause
LITELLM_PRISMA_COMMAND_TIMEOUTand redeploy before the gateway will come up at allAfter: the same upgrade boots in its usual window no matter how much spend history the database holds
Relevant issues
Reverts #37554
Linear ticket
Notes for the reviewer
The risk being backed out is not a newly observed failure. #37554 documented it in its own Caveats and body: the UPDATE seq-scans the table and rewrites every matching heap tuple, prisma runs it under
LITELLM_PRISMA_COMMAND_TIMEOUT, and a table where it needs longer times out, rolls back, and fails the boot until an operator raises that variable for the one deploy that performs the backfill. Trading a guaranteed boot for more honest historical timestamps is the wrong side of that trade for large deployments, so the backfill comes out#37554 shipped in
v1.99.0-dev.2, so any database that booted that build has20260819000000_backfill_spend_log_timestampsrecorded as applied while this branch no longer ships the directory. The v2 resolver's applied-but-unknown check compares each unknown migration's timestamp strictly against the newest migration this build ships, and the newest is still20260819000000(shadow_eval_max_budget), so the deleted name does not clear that bar and the check stays quiet. Those databases keep whatever the backfill already wrote, which is the correct value anyway; nothing is un-backfilled by this revertschema.prismais untouched, matching #37554, which only added data-only SQL and changed no schema. No test is added or removed: the change is the deletion of a raw SQL file and the repo has no harness that executes migration SQL against a databasePre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Pending, to be replaced with the live run before review
Type
🚄 Infrastructure
Caveats (if any)
v1.99.0-dev.2keep the backfill they already ranFinal Attestation