New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lmdb database corrupted after mdb_dump / mdb_load #8873
Comments
The post you referenced is from a Monero-specific forum and is specific to the way Monero builds LMDB. It does not apply to LMDB in general. By default, 32bit and 64bit LMDB files are not compatible. There was a bug in mdb_dump/load dealing with backslash-escaped characters, fixed in the recent (January 30) release, perhaps you've encountered that. Also, if your DBs use custom sort functions, mdb_load may be changing the sort order on you. The fix for this is in mdb.master but not yet in a public 0.9 release. |
Hi @hyc, thanks for dropping by! A quick grep for
Ah, I thought it would be something like that, I posted something along those lines at desec-io/desec-ns#27 (comment) |
The obvious thing to do is take a DB, dump/load it, dump/load that, and do a binary diff across all 3 results. The first two will probably be different if the original DB has been subject to interleaved adds and deletes, but the second two ought to be identical. |
Ah, thank you for clarifying!
Yes! I built The file size of the restored database has changed as well (62 MB with old version, 77 MB with new version). Just trying to make sure that nothing else is off. |
not a pdns bug |
I'm surprised there is such a difference in performance, but I suppose it's plausible. If the keys are being misinterpreted due to the bug, then they may no longer appear to be in sorted order, which will cause inserts to have a lot more seek overhead than otherwise. The difference in size could be due to some keys being seen as duplicates and overwriting each other, or simply due to inserting into previously split pages (whereas an in-order load would never revisit already used pages). |
Ok, thanks for the heads-up. While hard to quantify, it sounds like the effects are in the right direction, and thus no reason for concern. Yay! :) |
Short description
When dumping and restoring the lmdb database with the below commands, the database is at least partly corrupted. I get correct DNS responses, but adding a zone via the API fails.
Environment
Steps to reproduce
shopt -s extglob; for file in pdns.lmdb pdns.lmdb-+([0-9]); do echo $file; mdb_dump -f /backup/$file.dump -n -a $file; done
for file in /backup/*.dump; do echo $file; mdb_load -f $file -n $(basename $file .dump); done
Expected behaviour
regular operation
Actual behaviour
Other information
This post by lmdb developer @hyc says that files should be binary compatible as long as you stay on Intel/AMD (little-endian). Word size does not appear to matter anymore. So, directly using the backup should work.
The text was updated successfully, but these errors were encountered: