]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
ruledb: drop the MDB_WRITEMAP flag docs-ruledb-k10yl5/deployments/8914
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 12 Mar 2026 10:34:01 +0000 (11:34 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 22 Apr 2026 08:18:46 +0000 (10:18 +0200)
I like the property of mapping this memory as read-only.
All writes should have been deferred to the policy-loader,
at least in normal operation.

lib/cache/cdb_lmdb.c

index 624786054cb6e72e6a6525beb747443b705ea035..0319b5cbb3d9e2d84bae5843597a75f9e080ae9a 100644 (file)
@@ -358,7 +358,10 @@ static int cdb_open_env(struct lmdb_env *env, const char *path, const size_t map
                /* Cache doesn't require durability, we can be
                 * loose with the requirements as a tradeoff for speed. */
                ? MDB_WRITEMAP | MDB_NOTLS | MDB_MAPASYNC
-               : MDB_WRITEMAP | MDB_NOTLS;
+               /* ruledb is quite different in terms of writes.
+                * MDB_WRITEMAP|MDB_MAPASYNC wouldn't benefit us much,
+                * so instead we get better protection + (integrity on crashes).*/
+               : MDB_NOTLS;
        ret = mdb_env_open(env->env, path, flags, LMDB_FILE_MODE);
        if (ret != MDB_SUCCESS) goto error_mdb;