Repository navigation
refactor(rust): track ClickHouse migrations in a checksummed ledger - #44580
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
yujonglee-berri
approved these changes
Oct 5, 2026
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:
_sqlx_migrationsand apply only pending migrationsRETENTIONpolicy on every startIntentional product change: editing an applied migration disables tracing at startup so an incompatible schema cannot silently continue. The proxy still serves traffic
User Flow
Before: restarting repeats schema work even when nothing changed
After: restarting preserves the applied schema and refreshes retention
retention_days, and every trace table picks up the new TTLPre-Submission checklist
Local validation: 212 Rust tests against real ClickHouse, 75 Python tracing tests,
cargo check --workspace --all-targets, Clippy with warnings denied, and formatting passed. Greptile scored 5/5 at 19ffc67. CI is pending at this tipScreenshots / Proof of Fix
Live ClickHouse 26.9.6.6 and the proxy on localhost:4000. Before ran against localhost:18123 with merge-base Python source and a cached native extension whose Rust source matches the merge base. After ran against localhost:8123 with the native extension rebuilt from 19ffc67
Set CLICKHOUSE_URL to your authenticated ClickHouse URL with
output_format_json_quote_64bit_integers=1&async_insert=1&wait_for_async_insert=0. Set CLICKHOUSE_DATABASE topr44580_live_before_basefor Before andpr44580_live_after_sqlxfor After. Start withLITELLM_RUST=1 python -m litellm.proxy.proxy_cli --config config.yaml --port 4000The local curl configuration supplied authentication privately. Substitute your own credentials and port when reproducing
Before (02f61c9)
curl -sS -w '\nHTTP %{http_code}\n' http://localhost:4000/health/livelinessreturns"I'm alive!"andHTTP 200{"creates":1}. QueryEXISTS TABLE pr44580_live_before_base.schema_migrations:0"I'm alive!"andHTTP 200. Repeat the ClickHouse commands:{"creates":2}. No ledger existsAfter (19ffc67)
"I'm alive!"andHTTP 200{"creates":1}. QuerySELECT count() AS rows, uniqExact(version) AS versions FROM pr44580_live_after_sqlx._sqlx_migrations WHERE success FORMAT JSONEachRow:{"rows":15,"versions":15}.system.tablesshowstoIntervalDay(7)TTLs onotel_traces,agent_traces_by_key, andspend_logsHTTP 200, creates stay at{"creates":1}, the ledger stays at{"rows":15,"versions":15}, and the log has no "tracing unavailable" lineretention_days: 3. The health curl returnsHTTP 200, creates and ledger are unchanged, and all three TTLs now showtoIntervalDay(3)'00'and restart. The health curl still returnsHTTP 200, and the log showsAgent tracing unavailable: migration 1 was previously applied but has been modifiedType
Bug Fix, Refactoring
Caveats
Severe
Medium
Migrator::run_direct, pinned at 0.9.0Low
RETENTION, not new migrationsFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/048172f0828249fd840be1c3fbee23d4
Open in Devin Desktop: https://app.devin.ai/desktop/session/048172f0828249fd840be1c3fbee23d4?variant=devin
Requested by: @yujonglee-berri