tursodatabase / tursodatabase/libsql
If the DB is never snapshotted then restoration fails
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 17.2k
- Forks
- 531
- Avg merge
- 1h 12m
- Merged PRs (30d)
- 1
Description
If the DB is never snapshotted, that is only WAL frames are uploaded to S3, then while restoring integrity_check fails. This is mitigated by snapshot at shutdown, but can happen for an unclean shutdown
To reproduce:
Create a new database and insert a couple of rows. Try to verify from bottomless, it fails with following message:
Verification failed: *** in database main ***
Tree 2 page 2: btreeInitPage() returns error code 11
I restored the db and inspected the db from shell, all the data seems to be present though:
sqlite> PRAGMA integrity_check;
*** in database main ***
Page 2: btreeInitPage() returns error code 11
Error: stepping, database disk image is malformed (11)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the WAL-only restore and running verify, then compare its result with PRAGMA integrity_check in the restored database. Trace the restoration path for a database that has never been snapshotted; done means unclean or WAL-only recovery produces a database that passes integrity checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100