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

Ensure backwards-compatibility for bincode-serialized data #208

Open badboy opened 3 years ago

badboy commented 3 years ago

As the "safe-mode" storage uses bincode to serialize the data into a file on disk, there should be some tests that this won't break. rkv needs to be able to load data written with previous versions. bincode doesn't necessarily guarantee that (though to my knowledge they haven't broken it either).

Some tests could be useful. Write some data into a file, then use that file's data in a test (either load it or embed it directly) and check that it can be loaded and contains the expected data. Dependency updates shouldn't break that test then.

victorporof commented 3 years ago

There's probably hundreds of tests for this already. Is there one in particular you'd like to see better implemented?

badboy commented 3 years ago

In this repository or on bincode itself? I might have missed that here.

victorporof commented 3 years ago

Hmm, I think I misread your original comment. You meant storing the current version of a database file, and persisting that as a test for future versions. Gotcha – yes, this is a good idea!