]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/rules: increase the ruledb mapsize docs-ruledb-capac-g370u7/deployments/9789 1885/head
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 19 Jun 2026 12:48:46 +0000 (14:48 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 6 Aug 2026 09:21:24 +0000 (11:21 +0200)
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)

NEWS
lib/rules/api.c

diff --git a/NEWS b/NEWS
index 2c936e42c3c44b440e2d7d09b8b070131a2a014e..f467448bcce314d943dfa50c456b9a5f19ab0f0a 100644 (file)
--- 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)
 ================================
index 3b87c9eeb6d3d78f2c7c553b2f7d0603f01a2a4d..44042482b56ecdc1ef87f54c57ba8b1bcf9a8713 100644 (file)
@@ -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);