Repository navigation
Conversation
A background service registers as soon as it listens and opens the database afterwards, so a synchronous checkpoint of a large WAL on a slow disk keeps /api/info from answering right after registration. SQLite already runs the same passive checkpoint after a commit once the WAL passes wal_autocheckpoint.
3 of 6 tasks
This branch has not been deployed
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.
Issue for this PR
N/A. Split out of #63729.
Type of change
What does this PR do?
Removes the
PRAGMA wal_checkpoint(PASSIVE)that runs when the database opens.A background service registers as soon as it listens and opens the database afterwards (
packages/server/src/process.ts). The checkpoint runs synchronously on the event loop, so with a large WAL on a slow disk/api/infostops answering right after registration and clients count the booting service as unresponsive. #54810 has a 300 MB WAL on an HDD.This moves the work rather than removing it: SQLite runs the same passive checkpoint after a commit once the WAL passes
wal_autocheckpoint(1000 pages by default, which we don't change). Opening the database and checking migrations still run on the event loop, so boot on a stalled disk can still block health probes.The checkpoint was added in #13633 to clean up stale WAL data after a kill mid-write and avoid
SQLITE_MISUSE. SQLite recovers the WAL on open by itself and ignores frames from transactions that never committed, so I don't expect that to come back, but I haven't reproduced the original error. That's why this is a draft.No feature flag: it removes one statement from database startup.
How did you verify your code works?
packages/core:bun typecheck, anddatabase.test.ts,database-drizzle.test.ts,database-migration.test.ts,storage-failure.test.tson WindowsScreenshots / recordings
N/A
Checklist