I’m using FoundationDB 7.3.43 on Linux 6.10.10. Due to reasons most of the auxiliary files in my directory got deleted before I could add another server to the cluster. I was left with the large data file that doubtless holds most of it, at /var/lib/foundationdb/data/4500/storage-$HASH.sqlite. I need to recover data from this, and/or import it into a new database, but can’t figure out how to read it. Please advise.
P.S. I did try setting up an fdb instance, running configure new single ssd, and copying in the old storage-HASH.sqlite with the name of the new one while deleting the .sqlite-wal file. No dice; fdb seems to just hang. I skimmed the trace log and don’t see anything obvious, but could be missing something since there’s quite a lot of output.
However, I tried doing that and no difference. I tried copying it to a new cluster in place of that cluster’s storage .sqlite file and got the same, only with database corruption line 2411 before the broken promise. I tried removing the .sqlite-wal file and got onlyFatal Error: Broken promise. Finally, I tried running touch storage-HASH.sqlite-wal` and I could finally get a working dump
I’m pretty sure that the kvfiledump role is for “emergency” recoveries like this… I don’t think it’s part of a supported backup/restore path. I suspect you would need to build your own tooling to write these K/V pairs back to the database again (perhaps as part of your application that’s already connecting to FDB.)
Thanks. I ended up hacking the code a little to dump each kv pair in base64 format and figured I’d reimport it with python. But what if the pairs were in a directory? Will the dumped keys carry that info?
My concern is if the application is expecting to find something in a directory, and this dump doesn’t capture directory structure, it might not be able to see the data.
Ah, I see the misunderstanding. FoundationDB is overloading the use of the term “directory” here. From the FDB docs (emphasis mine):
The directory “layer” represents directories as tuples within the tuple “layer”, which are themselves represented as a single key within the database. Another snippet from the docs (emphasis mine):
So the TL;DR is: if you’ve retrieved all of your keys and values from the dump of the storage server, any “tuples” or “directories” should be encoded within the key/value pairs themselves. They’re not treated any differently than any other data, and wouldn’t result in actual directories on the filesystem.