From: Vladimír Čunát Date: Fri, 22 Mar 2024 10:56:30 +0000 (+0100) Subject: lib/rules: increase default DB size to 2G on 64-bit platforms X-Git-Tag: v6.0.7~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d36161f5f486eb4c119ffdaa7a39c7612743ff92;p=thirdparty%2Fknot-resolver.git lib/rules: increase default DB size to 2G on 64-bit platforms 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 --- diff --git a/NEWS b/NEWS index 48246cdb3..e433fc8d8 100644 --- 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 -------- diff --git a/lib/rules/api.c b/lib/rules/api.c index cdedd2aec..ca0268797 100644 --- a/lib/rules/api.c +++ b/lib/rules/api.c @@ -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.