From: Vladimír Čunát Date: Fri, 19 Jun 2026 12:48:46 +0000 (+0200) Subject: lib/rules: increase the ruledb mapsize X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bcf3277d846f8cc08c98188e8cb0455befaff7ce;p=thirdparty%2Fknot-resolver.git lib/rules: increase the ruledb mapsize When this LMDB gets full as a result of very many rules, it prints: [rules ] LMDB error: MDB_MAP_FULL: Environment mapsize limit reached (cherry picked from commit 58fa3ad916a7ae5c89e2d9f1e3fc610bab408bcd) --- diff --git a/NEWS b/NEWS index 2c936e42c..f467448bc 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ Packaging --------- - arch: updates and cleanup (!1858) +Improvements +------------ +- local-data: increase capacity to 63 GiB (logged MDB_MAP_FULL, !1885) + Knot Resolver 6.4.2 (2026-08-05) ================================ diff --git a/lib/rules/api.c b/lib/rules/api.c index 3b87c9eeb..44042482b 100644 --- a/lib/rules/api.c +++ b/lib/rules/api.c @@ -168,11 +168,11 @@ int kr_rules_init(const char *path, size_t maxsize, bool overwrite) struct kr_cdb_opts opts = { .is_cache = false, .path = path ? path : "ruledb", // under current workdir - // FIXME: the file will be sparse, but we still need to choose its size somehow. - // Later we might improve it to auto-resize in case of running out of space. // Caveat: mdb_env_set_mapsize() can only be called without transactions open. + // Note that this value does not affect file size thanks to not using MDB_WRITEMAP. + // Large mmap would cause issues with valgrind: https://stackoverflow.com/a/59834216 .maxsize = !overwrite ? 0 : - (maxsize ? maxsize : (size_t)(sizeof(size_t) > 4 ? 2048 : 500) * 1024*1024), + (maxsize ? maxsize : (size_t)(sizeof(size_t) > 4 ? 63 * 1024 : 500) * 1024*1024), }; int ret = the_rules->api->open(&the_rules->db, &the_rules->stats, &opts);