Commit 61230685 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

namedb: increase lmdb mapsize limit to 100 MB

parent 362dc8fb
......@@ -18,12 +18,14 @@
#include <lmdb.h>
#include <sys/stat.h>
#include <unistd.h>
#include "common/namedb/namedb_lmdb.h"
#include "libknot/errcode.h"
#define LMDB_DIR_MODE 0770
#define LMDB_FILE_MODE 0660
#define LMDB_DIR_MODE 0770
#define LMDB_FILE_MODE 0660
#define LMDB_MAPSIZE (100 * 1024 * 1024)
struct lmdb_env
{
......@@ -49,6 +51,19 @@ static int dbase_open(struct lmdb_env *env, const char *path)
return ret;
}
long page_size = sysconf(_SC_PAGESIZE);
if (page_size <= 0) {
mdb_env_close(env->env);
return KNOT_ENOTSUP;
}
size_t map_size = (LMDB_MAPSIZE / page_size) * page_size;
ret = mdb_env_set_mapsize(env->env, map_size);
if (ret != 0) {
mdb_env_close(env->env);
return ret;
}
ret = create_env_dir(path);
if (ret != KNOT_EOK) {
mdb_env_close(env->env);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment