penberg / limbo

Limbo is a work-in-progress, in-process OLTP database management system, compatible with SQLite.
MIT License
972 stars 59 forks source link

Fix error handling for invalid database files #72

Closed penberg closed 2 months ago

penberg commented 3 months ago

If you attempt to open an invalid database file with SQLite, you see:

penberg@vonneumann limbo % sqlite3 testing/all.test
SQLite version 3.45.2 2024-03-12 11:06:23
Enter ".help" for usage hints.
sqlite> .schema
Error: file is not a database

However, Limbo just gets totally confused:

penberg@vonneumann limbo % cargo run testing/all.test
warning: unused variable: `c`
  --> core/io/darwin.rs:51:9
   |
51 |         c: Rc<WriteCompletion>,
   |         ^ help: if this is intentional, prefix it with an underscore: `_c`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: `limbo_core` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.27s
     Running `target/debug/limbo testing/all.test`
thread 'main' panicked at core/storage.rs:70:9:
assertion failed: (page_size & (page_size - 1)) == 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
crrow commented 3 months ago

Hello, I'm new to this, but I'm interested in this project. May I have a chance to give it a try?

penberg commented 3 months ago

@crrow go for it!

penberg commented 2 months ago

This works fine now:

penberg@vonneumann limbo % ./target/debug/limbo testing/all.test
Error: file is not a database