General database

From Messaging Server Technical Reference Wiki
Jump to: navigation, search

The MTA's general database is available for site-specific uses. When a site could benefit from a database lookup from a rewrite rule, from a mapping table, or from a Sieve filter (see the EXTLISTS extension), the general database provides a simple, MTA-accessible place to store such site-specific data. (Note that the MTA also supports LDAP, memcache, and MeterMaid, and Redis lookups, which could all be considered forms of "database" lookup. But what is meant here is more specifically an on-disk or in-memory, basic, key-value "database".)

In early versions of the MTA, the format of the general database was an on-disk database, built using the imsimta crdb utility based upon a flat text file input. As of MS 6.0, the option -- now preferred -- was introduced for storing the "database" directly in MTA process memory; use of such an "in memory database" is enabled via the use_text_databases MTA option. When enabled, such an "in memory database" is constructed from a flat text input file at the time of a cnbuild command being issued, or at process startup time (if no compiled configuration is used). The allowed format of the flat text input file is very similar whether an old crdb database is constructed, or whether a use_text_databases "in memory" database is constructed:

key value

one entry per line, with the key beginning in column one, one or more white space (SP or TAB) characters, and then the value on the right hand side.

When using a text, "in memory" general database (bit 0/value 1 of use_text_databases is set), each left hand side (key) may have a maximum of 128 characters, while each right hand side (value) may have a maximum of 1024 characters. If a key or value contains any space or tab character, such character must be backslash quoted, e.g.:

left\ hand\ side right-hand-side

Any TAB character found will be converted to a space for storage in the in-memory general database.

The comment_chars MTA option controls which characters (by default exclamation point and semicolon) in column one of a line are considered to indicate a comment line. The left angle character may be used to read another file into the general database text input file.

Note: The MTA options general_data_size and string_pool_size_3 limit the overall size of the general database; these MTA options do not normally need to be manually adjusted.

For a crdb "on disk" database, the left hand side (the key) cannot contain spaces or tabs unless the -quoted switch is used; the maximum length of the key and value depend upon whether the -long_records switch is used.

See also: