Skip to content

Fix dotlk data corruption. - #449

Merged
ncruces merged 1 commit into
mainfrom
dotlk
Nov 7, 2026
Merged

ncruces merged 1 commit into
mainfrom
dotlk

Conversation

@ncruces

@ncruces ncruces commented Nov 7, 2026

Copy link
Copy Markdown
Owner

The copy scheme compared private against a shadow of the whole WAL-index, assuming they only diverge while publishing a commit.

A transaction that spills frames to the WAL and rolls back breaks this: SQLite writes hash tables under WAL_WRITE_LOCK but, since the header does't change (because of the rollback), nothing gets published or reverted. The leftover garbage later gets published to shared memory, so a checkpoint skips committed frames and corrupts the database.

Now, only the 136-byte header is merged word by word; the hash tables are copied wholesale:

  • out, by the write-lock holder when it publishes a header;
  • in, by everyone else when they see a new header.

@ncruces
ncruces merged commit 2d9b687 into main Nov 7, 2026
@ncruces
ncruces deleted the dotlk branch November 7, 2026 01:19
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.

1 participant