Please review rt46718 which applies a number of fixes, tweaks and cleanups to LMDB-related code. Suggestions regarding naming and placement of DNS_LMDB_* constants (see commit 1970f078cf) are welcome.