kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
484 stars 39 forks source link

mdb_dump #63

Closed 1N50MN14 closed 3 years ago

1N50MN14 commented 3 years ago

Apologies forehand this is not directly related to lmdb-store itself, I'm trying to perform a backup using using mdb_dump (aka mdb_dump -f data.mdb.dump -n data.mdb) but the tool is throwing an error mdb_env_open failed, error -30793 MDB_INVALID: File is not an LMDB file - I'm wondering if it's a version compatibility issue or if there's a better way of doing that maybe just snapshot the whole volume, any tips would be appreciated..

kriszyp commented 3 years ago

Just to review version/compatibilities, there are currently two primary distinct versions of LMDB, with incompatible data formats:

lmdb-store is using the latter, mdb.master3, but I'm sure most libraries/distributions still use the older version (including node-lmdb). I have actually been thinking about including both of them in lmdb-store, along with a build option to choose the older version if desired: https://github.com/DoctorEvidence/lmdb-store/commit/38b36b9ae1c2b1fe5c409255ffeb3fc95917fdbc#diff-0d6aa7470314ca774fd7e07f67b35ecd3045fe5cb3a0e5c99f48bae897905d32

However, all that being said, this is all probably irrelevant (sorry, I didn't feel like erasing what I typed), because if the version is different you will actually get a MDB_VERSION_MISMATCH error, not a MDB_INVALID error. The MDB_INVALID should only happen if the initial bytes don't match the unique "magic" header, 0xBEEFC0DE. This can also happen if the file is empty, or could be caused if it was saved on a different endian than the current machine.

Also, I don't know if helps, but lmdb-store does have a backup method for making a copy of database, for the sake of making backup/snapshot of a database.

1N50MN14 commented 3 years ago

However, all that being said, this is all probably irrelevant (sorry, I didn't feel like erasing what I typed)

hahaha probably the coolest comment ever :100: :1st_place_medal:

Also, I don't know if helps, but lmdb-store does have a backup method for making a copy of database, for the sake of making backup/snapshot of a database.

It does! this is even better how on earth did I even miss it! Going to look it up right away, thank you! :)