kriszyp / lmdb-js

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

Should db-lock be committed? #145

Closed aleclarson closed 2 years ago

aleclarson commented 2 years ago

If I'm keeping my database in a git repo, should I commit the db-lock or is that wholly optional?

kriszyp commented 2 years ago

No, the db-lock files are only used for (runtime) locks, and don't contain any "real" data, so you can freely omit/delete them and treat them as optional.

Also of note, and this might not be relevant or you may already be aware of this, but it is considered unsafe to copy (or commit) a database file while you are actively writing to it (the copy can end up with out of sync pages that are corrupt), and lmdb-js has a backup method for copying a database file while it is in use.

And more potentially irrelevant information, but just in case: lmdb databases are not 100% portable, the format does use the architecture's native "word" format, so I believe the format is dependent on little endian vs big endian and 32-bit vs 64-bit. Of course, anything but 64-bit LE is quite rare these days, so practically it is pretty portable, but just how rare depends on your application, I suppose. Also, lmdbx-js does feature a platform-independent format (but I would stick with lmdb-js unless you really need that).

aleclarson commented 2 years ago

Thanks!