]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/rules: increase default DB size to 2G on 64-bit platforms docs-develop-impr-ktrcol/deployments/3562
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 22 Mar 2024 10:56:30 +0000 (11:56 +0100)
committerOto Šťáva <oto.stava@nic.cz>
Fri, 22 Mar 2024 13:16:47 +0000 (14:16 +0100)
The file is sparse, which really is supported by all sane filesystems
nowadays I think.  But for 32-bit systems I'm a bit afraid for the
ability to reliably get such a large contiguous mapping in process memory,
so there we take the 500M limit tested in knot-dns:
https://gitlab.nic.cz/knot/knot-dns/-/blob/v3.3.5/src/knot/conf/schema.c#L39

NEWS
lib/rules/api.c

diff --git a/NEWS b/NEWS
index 48246cdb349164150f46bfef44992473e208c5e6..e433fc8d8cbc0303995a685990d26996f20315a7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Improvements
 - docs: documentation is now separated into user and developer parts (!1514)
 - daemon: ignore UDP requests from ports < 1024 (!1507)
 - manager: increase startup timeout for processes (!1518)
+- local-data: increase default DB size to 2G on 64-bit platforms (!1518)
 
 Bugfixes
 --------
index cdedd2aec67619403d7523a6825f6c2db8b71c9a..ca0268797c9b6fb8fadff225cca23e2b627d9e24 100644 (file)
@@ -157,7 +157,8 @@ int kr_rules_init(const char *path, size_t maxsize)
                // 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.
-               .maxsize = maxsize ? maxsize : 100 * 1024*(size_t)1024,
+               .maxsize = maxsize ? maxsize :
+                       (sizeof(size_t) > 4 ? 2048 : 500) * 1024*(size_t)1024,
        };
        int ret = the_rules->api->open(&the_rules->db, &the_rules->stats, &opts, NULL);
        /* No persistence - we always refill from config for now.