chickadee » lmdb-lolevel » mdb-env-set-mapsize

mdb-env-set-mapsize env sizeprocedure

Set the size of the memory map to use for this environment.

The size should be a multiple of the OS page size. The default is 10485760 bytes. The size of the memory map is also the maximum size of the database. The value should be chosen as large as possible, to accommodate future growth of the database. This function should be called after (mdb-env-create) and before (mdb-env-open). It may be called at later times if no transactions are active in this process. Note that the library does not check for this condition, the caller must ensure it explicitly.

The new size takes effect immediately for the current process but will not be persisted to any others until a write transaction has been committed by the current process. Also, only mapsize increases are persisted into the environment.

If the mapsize is increased by another process, and data has grown beyond the range of the current mapsize, (mdb-txn-begin) will return MDB_MAP_RESIZED. This function may be called with a size of zero to adopt the new size.

Any attempt to set a size smaller than the space already consumed by the environment will be silently changed to the current size of the used space.

env
An environment handle returned by (mdb-env-create)
size
The size in bytes

Some possible error conditions:

(exn lmdb EINVAL)
an invalid parameter was specified, or the environment has an active write transaction.