Postfix uses databases of various kinds to store and look up information. Postfix databases are specified as "type:name". OpenLDAP LMDB implements the Postfix database type "lmdb". The name of a Postfix OpenLDAP LMDB database is the name of the database file without the ".lmdb" suffix.
This document describes:
How to build Postfix with OpenLDAP LMDB support.
How to configure LMDB settings.
Missing pthread library trouble.
Unexpected failure modes that don't exist with other Postfix databases.
Postfix normally does not enable OpenLDAP LMDB support. To build Postfix with OpenLDAP LMDB support, use something like:
% make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \ AUXLIBS="-L/usr/local/lib -llmdb" % make
Solaris may need this:
% make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \ AUXLIBS="-R/usr/local/lib -L/usr/local/lib -llmdb" % make
The exact pathnames depend on how OpenLDAP LMDB was installed.
Postfix provides one configuration parameter that controls OpenLDAP LMDB database behavior.
lmdb_map_size (default: 16777216). This setting specifies the initial OpenLDAP LMDB database size limit in bytes. Each time a database becomes full, its size limit is doubled. The maximum size is the largest signed integer value of "long".
When building Postfix fails with:
undefined reference to `pthread_mutexattr_destroy' undefined reference to `pthread_mutexattr_init' undefined reference to `pthread_mutex_lock'
Add the "-lpthread" library to the "make makefiles" command.
% make makefiles .... AUXLIBS="... -lpthread"
Source code for OpenLDAP LMDB is available at http://www.openldap.org. More information is available at http://highlandsun.com/hyc/mdb/.
As documented below, conversion to LMDB introduces a number of failure modes that don't exist with other Postfix databases. Some failure modes have been eliminated in the course of time. The writeup below reflects the status as of LMDB 0.9.9.
Non-obvious recovery with postmap(1), postalias(1), or tlsmgr(8) from a corrupted database.
A corrupted LMDB database cann't be rebuilt simply by re-running postmap(1) or postalias(1), or by waiting until a tlsmgr(8) daemon restarts. This problem does not exist with other Postfix databases.
The Postfix LMDB database client does not truncate the database file. Instead it attempts to create a transaction for a "drop" request plus subsequent "store" requests. That is obviously not possible with a corrupted database file.
Postfix does not process mail until someone fixes the problem.
First delete the ".lmdb" file by hand. Then rebuild the file with the postmap(1) or postalias(1) command if the file was created with those commands, or restart postfix daemons if the file is maintained by tlsmgr(8).
Arrange your file systems such that they never run out of free space.
Use ECC memory to detect and correct silent corruption of in-memory file system data and metadata.
Use a file system such as ZFS to detect and correct silent corruption of on-disk file system data and metadata. DO NOT use ZFS on systems without ECC memory error correction.