tursodatabase / tursodatabase/libsql

Improve error handling on databases without metadata

Open
#2,013 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug offline writes
Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

If you dump a database and create a database file out of it:

turso db shell example .dump > example.sql
cat example.sql | sqlite3 example.db
sqlite3 example.db 'PRAGMA journal_mode = WAL'

The sync code happily allows to sync this with no knowledge of the previous sync point and, therefore, eventually corrupt the database.

Let's add error handling to detect a SQLite file without sync metadata and refuse to sync.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the documented dump and SQLite commands, then trace the sync path for a database file with no previous sync metadata. The work is done when that case is detected and synchronization is refused with a clear error instead of proceeding toward corruption; no file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
sqlite
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.