mozilla / rkv

A simple, humane, typed key-value storage solution.
https://crates.io/crates/rkv
Apache License 2.0
304 stars 52 forks source link

Should an empty file be considered invalid? #212

Open badboy opened 3 years ago

badboy commented 3 years ago

For some reason yet unknown to me we saw empty data.safe.bin files for Rkv databases as used inside Firefox by Glean. This causes issues (and crashes) because Rkv bailed out and considers an empty file to be invalid (because it can't decode the data).

Our solution is to remove the empty file and try again.

Now the question is if that's something that Rkv should handle directly? An empty file is not really invalid IMO.

(I know Rkv shouldn't create an empty file)