[fix] Build the records sequence index concurrently - #6576
Conversation
Create and drop the records sequence index concurrently from Alembic autocommit blocks so populated tracing tables remain writable during the index operation. Cover empty and populated-table upgrades and downgrades in a disposable tracing database. Claude-Session: https://claude.ai/code/session_0164kzT6ttwpBtzvcDC6YzYk
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
mmabrouk
left a comment
There was a problem hiding this comment.
SHIP
The migration builds and drops the unique records sequence index concurrently inside Alembic autocommit blocks, while leaving the nullable column addition unchanged. The disposable PostgreSQL test covers empty and 4,096-row upgrades and downgrades, verifies the unique index definition, and confirms existing rows and payloads remain intact. Focused migration tests and the Ruff 0.15.12 API pass are clean.
Railway Preview Environment
|
Context
The session live-events migration built a unique index on the existing
recordstable with a regularCREATE UNIQUE INDEX. On a large tracing table, that blocks record writes for the duration of the build even when all live-events flags are off.Changes
Build
ux_records_session_id_sequencewith PostgreSQL's concurrent index mode inside an Alembic autocommit block. The downgrade uses the same concurrent path when dropping the index. The nullablerecords.sequencecolumn addition is unchanged.Tests
nice -n 19 uv run --no-sync pytest -o 'addopts=-ra --self-contained-html' oss/tests/pytest/unit/migrations/test_tracing_session_sequence_chain.py oss/tests/pytest/unit/migrations/test_tracing_session_sequence_migration.py -qrecordstables in the disposableagenta_m2idx_tracingdatabase.nice -n 19 uvx ruff@0.15.12 format .nice -n 19 uvx ruff@0.15.12 check --fix .https://claude.ai/code/session_0164kzT6ttwpBtzvcDC6YzYk