Skip to content

Conversation

@penberg
Copy link
Collaborator

@penberg penberg commented Nov 28, 2024

We have a problem with WAL API where in some scenarios, we seem to lose WAL frames that were already applied. However, inspecting the external WAL frame, the sync mechanics work fine and the problem is in SQLite's in-memory state.

We have a problem with WAL API where in some scenarios, we seem to lose
WAL frames that were already applied. However, inspecting the external
WAL frame, the sync mechanics work fine and the problem is in SQLite's
in-memory state.

As it turnws out, the sqlite3PagerWalBeginCommit() function first begins
a read transaction and then upgrades it to a write transaction. However,
sqlite3PagerWalEndCommit() only ends the write transaction and therefore
leaves the pager in READER state. Let's call pager_unlock() to switch to
OPEN stte, fixing the issue of disappearing frames.
@penberg penberg force-pushed the fix-disappearing-frames branch from 03f68cf to 1a94157 Compare November 28, 2024 11:23
We need to reset the pager in sqlite3PagerWalEndCommit() to make sure
page cache is invalidated after injecting frames to WAL to ensure
they're visible.
We need to make sure we test a case where page cache is non-empty.
@penberg penberg force-pushed the fix-disappearing-frames branch from 1a94157 to adb5eeb Compare November 28, 2024 14:43
@penberg penberg enabled auto-merge November 28, 2024 14:43
@penberg penberg added this pull request to the merge queue Nov 28, 2024
Merged via the queue into main with commit 76f1788 Nov 28, 2024
19 checks passed
@penberg penberg deleted the fix-disappearing-frames branch November 28, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants