Function lmdb_master_sys::mdb_env_set_mapsize
source · pub unsafe extern "C" fn mdb_env_set_mapsize(
env: *mut MDB_env,
size: mdb_size_t,
) -> c_int
Expand description
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.
§Arguments
env
(direction in) - An environment handle returned by #mdb_env_create()size
(direction in) - The size in bytes
§Returns
A non-zero error value on failure and 0 on success. Some possible errors are:
- EINVAL - an invalid parameter was specified, or the environment has an active write transaction.