Commit f8874bd7 authored by Libor Peltan's avatar Libor Peltan

lmdb: increased max no of readers for conf and journal

parent 329a74f0
......@@ -175,6 +175,7 @@ int conf_new(
out->api = knot_db_lmdb_api();
struct knot_db_lmdb_opts lmdb_opts = KNOT_DB_LMDB_OPTS_INITIALIZER;
lmdb_opts.mapsize = (size_t)CONF_MAPSIZE * 1024 * 1024;
lmdb_opts.maxreaders = CONF_MAX_DB_READERS;
lmdb_opts.flags.env = KNOT_DB_LMDB_NOTLS;
// Open the database.
......
......@@ -38,6 +38,8 @@
#define CONF_DEFAULT_DBDIR (STORAGE_DIR "/confdb")
/*! Maximum depth of nested transactions. */
#define CONF_MAX_TXN_DEPTH 5
/*! Maximum number of concurrent DB readers. */
#define CONF_MAX_DB_READERS 630
/*! Configuration specific logging. */
#define CONF_LOG(severity, msg, ...) do { \
......
......@@ -28,6 +28,8 @@
#define JOURNAL_VERSION "1.0"
/*! \brief Changeset chunk size. */
#define CHUNK_MAX (70 * 1024)
/*! \brief Max number of concurrent DB readers. */
#define JOURNAL_MAX_READERS 630
/*! \brief Various metadata DB key strings. Also hardcoded in macro txn_commit()! */
#define MDKEY_GLOBAL_VERSION "version"
......@@ -1351,6 +1353,7 @@ static int open_journal_db_unsafe(journal_db_t **db)
opts.path = (*db)->path;
opts.mapsize = (*db)->fslimit;
opts.maxdbs = 1;
opts.maxreaders = JOURNAL_MAX_READERS;
int ret = (*db)->db_api->init(&(*db)->db, NULL, &opts);
if (ret != KNOT_EOK) {
......
......@@ -140,6 +140,12 @@ static int dbase_open_env(struct lmdb_env *env, struct knot_db_lmdb_opts *opts)
return lmdb_error_to_knot(ret);
}
ret = mdb_env_set_maxreaders(mdb_env, opts->maxreaders);
if (ret != MDB_SUCCESS) {
mdb_env_close(mdb_env);
return lmdb_error_to_knot(ret);
}
#ifdef __OpenBSD__
/*
* Enforce that MDB_WRITEMAP is set.
......
......@@ -33,6 +33,7 @@ struct knot_db_lmdb_opts {
const char *dbname; /*!< Database name (or NULL). */
size_t mapsize; /*!< Environment map size. */
unsigned maxdbs; /*!< Maximum number of databases in the env. */
unsigned maxreaders; /*!< Maximum number of concurrent readers */
struct {
unsigned env; /*!< Environment flags. */
unsigned db; /*!< Database flags. */
......@@ -44,6 +45,7 @@ struct knot_db_lmdb_opts {
NULL, NULL, \
KNOT_DB_LMDB_MAPSIZE, \
0, \
126, /* = contrib/lmdb/mdb.c DEFAULT_READERS */ \
{ 0, 0 } \
}
......
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