Skip to content

Make SQLite schema migrations safe for concurrent startup - #59015

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/38004d58a5c637ac1b2be53d07fd9a4c8efec7ab
Nov 3, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/38004d58a5c637ac1b2be53d07fd9a4c8efec7ab

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Make SQLite schema migrations safe for concurrent startup

Why

SQLx's SQLite migration lock is a no-op, allowing concurrent database openers to race between schema version checks and migration changes.

What changed

Run schema checks and migrations in one transaction, retrying SQLite busy errors from a fresh snapshot. Databases with a current schema need only a read lock, including on NFS. Include the error cause chain when the app server reports SQLite initialization failures.

Testing

Add regression tests for eight concurrent database openers applying each migration once and for reopening a current schema while another connection holds a writer reservation with NFS settings.

## Why

SQLx's SQLite migration lock is a no-op, allowing concurrent database openers to race between schema version checks and migration changes.

## What changed

Run schema checks and migrations in one transaction, retrying SQLite busy errors from a fresh snapshot. Databases with a current schema need only a read lock, including on NFS. Include the error cause chain when the app server reports SQLite initialization failures.

## Testing

Add regression tests for eight concurrent database openers applying each migration once and for reopening a current schema while another connection holds a writer reservation with NFS settings.

GitOrigin-RevId: 38004d58a5c637ac1b2be53d07fd9a4c8efec7ab
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/38004d58a5c637ac1b2be53d07fd9a4c8efec7ab branch from de36e2f to 9e77fb4 Compare November 3, 2026 00:04
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-03T00:04:53.605441Z de36e2f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 9e77fb4 into main Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/38004d58a5c637ac1b2be53d07fd9a4c8efec7ab branch November 3, 2026 00:04
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 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.

1 participant