LMDB_TABLE(5)

πŸ’– LMDB_TABLE(5) πŸ’–

okay bestie, welcome to the File Formats Manual entry for lmdb_table β€” yes the manual section number is literally (5), we love a numbered era. this is the Postfix LMDB adapter and she is iconic, let's get into it. πŸŽ€


✨ NAME ✨

lmdb_table β€” the Postfix LMDB adapter. that's it, that's the whole name, short and slay. πŸ’…


✨ SYNOPSIS ✨

postmap lmdb:/etc/postfix/filename
postmap -i lmdb:/etc/postfix/filename <inputfile

postmap -d "key" lmdb:/etc/postfix/filename
postmap -d - lmdb:/etc/postfix/filename <inputfile

postmap -q "key" lmdb:/etc/postfix/filename
postmap -q - lmdb:/etc/postfix/filename <inputfile

like, that's the entire vibe check right there. you either build the thing, delete from the thing, or ask the thing a question. πŸ¦‹


✨ DESCRIPTION ✨

so the Postfix LMDB adapter gives you access to a persistent, memory-mapped, key-value store. yes bestie, memory-mapped. it's giving fast. ⚑

and the database size? literally only limited by two things:

  • the size of the memory address space β€” typically 31 or 47 bits on 32-bit or 64-bit CPUs respectively
  • the available file system space

no cap, that's genuinely the whole limit. πŸ‘‘


✨ REQUESTS ✨

the LMDB adapter supports all Postfix lookup table operations. every single one. so LMDB is suitable for:

  • Postfix address rewriting
  • routing
  • access policies
  • caches
  • literally any information that can be stored under a fixed lookup key

and here's the cute part β€” when a transaction fails because the database is full, Postfix resizes the database and retries the transaction. she just grows. 🌱

also, Postfix table lookups may generate partial search keys, like:

  • domain names without one or more subdomains
  • network addresses without one or more least-significant octets
  • email addresses without the localpart, address extension or domain portion

this behavior is also found with, for example, btree:, hash:, or ldap: tables. so it's not a weird LMDB thing, it's a whole family trait. 🫢

one more thing: changes to an LMDB database do not trigger an automatic daemon restart, and do not require a daemon restart with "postfix reload". so like... breathe, bestie, you're fine. πŸ’œ


✨ RELIABILITY ✨

LMDB's copy-on-write architecture provides safe updates β€” at the cost of using more space than some other flat-file databases. trade-offs, we've all been there. πŸ’€

  • Read operations are memory-mapped, for speed. zoom zoom. πŸ”₯
  • Write operations are not memory-mapped, to avoid silent corruption due to stray pointer bugs. protective queen behavior honestly.

and get this: multiple processes can safely update an LMDB database without serializing requests through the proxymap(8) service. so LMDB is suitable as a shared cache for verify(8) or postscreen(8) services. teamwork makes the dream work. 🌈


✨ SYNCHRONIZATION ✨

okay this section is important, so eyes up. πŸ‘€

the Postfix LMDB adapter does not use LMDB's built-in locking scheme, because that would require world-writable lockfiles and therefore violate the Postfix security model. nope, not happening, we don't do that here.

instead, Postfix uses fcntl(2) locks with whole-file granularity.

🚨 bestie listen: programs that use LMDB's built-in locking protocol will corrupt a Postfix LMDB database or will read garbage. i am not being dramatic. this is a real warning. do not do it.

every Postfix LMDB database read or write transaction must be protected from start to end with a shared or exclusive fcntl(2) lock. and:

  • a process may atomically downgrade an exclusive lock to a shared lock before opening a database read transaction
  • but it must hold an exclusive lock while opening a write transaction

also (and this one gets people every time): fcntl(2) locks do not protect transactions within the same process against each other. so if a program cannot avoid making simultaneous database requests, it must protect its transactions with in-process locks, in addition to the per-process fcntl(2) locks. two locks. two layers. that's the gig. πŸ”


✨ CONFIGURATION PARAMETERS ✨

short-lived programs automatically pick up changes to main.cf. but with long-running daemon programs, use the command "postfix reload" after a configuration change. don't forget, she's not psychic. 🧚

  • lmdb_map_size (16777216) β€” the initial OpenLDAP LMDB database size limit, in bytes.

✨ SEE ALSO ✨


✨ README FILES ✨

use "postconf readme_directory" or "postconf html_directory" to locate this information. very handy, very demure. πŸŽ€

  • DATABASE_README, Postfix lookup table overview
  • LMDB_README, Postfix OpenLDAP LMDB howto

✨ LICENSE ✨

the Secure Mailer license must be distributed with this software. periodt. πŸ“œ


✨ HISTORY ✨

LMDB support was introduced with Postfix version 2.11. an elder. a legend. she's been here a minute. 🫑


✨ AUTHOR(S) ✨

  • Howard Chu β€” Symas Corporation
  • Wietse Venema β€” IBM T.J. Watson Research, P.O. Box 704, Yorktown Heights, NY 10598, USA
  • Wietse Venema β€” Google, Inc., 111 8th Avenue, New York, NY 10011, USA

and that's the whole page bestie!! πŸ’– we got the LMDB_TABLE(5) entry, straight out of the File Formats Manual, footer and all β€” LMDB_TABLE(5) for you and your daemons. go forth, lock your transactions, and slay. πŸ‘‘βœ¨πŸŒΈ

πŸ“¦ where this page comes from