Skip to content

Avoid unnecessary writes during migration repair - #33687

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/76649213912b510df42a836cf8ed7f84a7c70eb5
Jul 16, 2026
Merged

Avoid unnecessary writes during migration repair#33687
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/76649213912b510df42a836cf8ed7f84a7c70eb5

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 16, 2026

Copy link
Copy Markdown

Avoid unnecessary writes during migration repair

Why

Opening a database with current migration history should not require SQLite's
writer slot. The legacy recency repair previously issued an UPDATE even when
there was nothing to repair, so it could fail while another connection held the
writer slot.

What changed

Check _sqlx_migrations for the legacy version and checksum before issuing the
repair update, and return early when the current recency migration is already
recorded.

Testing

Add a WAL-mode regression test that holds the writer slot on a second
connection and verifies that current migration history needs no write access.

## Why

Opening a database with current migration history should not require SQLite's
writer slot. The legacy recency repair previously issued an `UPDATE` even when
there was nothing to repair, so it could fail while another connection held the
writer slot.

## What changed

Check `_sqlx_migrations` for the legacy version and checksum before issuing the
repair update, and return early when the current recency migration is already
recorded.

## Testing

Add a WAL-mode regression test that holds the writer slot on a second
connection and verifies that current migration history needs no write access.

GitOrigin-RevId: 76649213912b510df42a836cf8ed7f84a7c70eb5
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/76649213912b510df42a836cf8ed7f84a7c70eb5 branch from 441b663 to 18110b8 Compare July 16, 2026 20:56
@copyberry
copyberry Bot merged commit 18110b8 into main Jul 16, 2026
14 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/76649213912b510df42a836cf8ed7f84a7c70eb5 branch July 16, 2026 20:57
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants