Closed RadonCoding closed 2 years ago
As the error says, by all leveldb-rs can see, the data is corrupt. Is this a possibility in your use case? Does it happen deterministically with new databases?
Unfortunately I have not yet implemented any resilience measures, mostly because leveldb (the original) is not known for handling corruption particularly well, either.
The database is not corrupted i tried with another crate rs-leveldb
and it worked just fine.
Oh, you opened a database not created by leveldb-rs with it? I've seen similar crashes before, but haven't investigated; most use cases just create their own DBs, which work. There is some bug lurking which detects some(?) foreign DBs as corrupt.
I tested this a bit back and forth, and my suspicion of the bug being centered on the compression part seems to be confirmed. And within that, snappy itself complains (in leveldb-rs), whereas opening a compressed leveldb-rs database with original LevelDB may also stumble on the decompressed block contents (but works fine with uncompressed databases).
Thank you for bringing this up - after 5 years I've finally managed to solve this bug. And it was quite trivial: I misused the snap
crate's API, and used the framed format instead of pure snappy compression. A cursory test confirms that interoperability now works.
fixed in 3d9a58510993460fa2d15a2ec0b5ec0abc95ed60
This is the error
Error: Status { code: IOError, err: "IOError: snappy: corrupt input (expected stream header but got unexpected chunk type byte 200)" }