]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/cache: add LMDB_NO_DROP to always unlink file without mdb_drop
authorMarek Vavruša <mvavrusa@cloudflare.com>
Thu, 23 Aug 2018 00:34:57 +0000 (17:34 -0700)
committerMarek Vavruša <mvavrusa@cloudflare.com>
Fri, 7 Sep 2018 17:45:21 +0000 (10:45 -0700)
The mdb_drop() can get slow when the cache size is several GB,
so that the init daemon times out when waiting for the daemon to start,
and keeps restarting it in a loop.

lib/cache/cdb_lmdb.c

index 621d2e881c867eedae10bdbece0c4863ff7a8ca3..fd6c9567373e467f5de15cd5d688e00967356ed3 100644 (file)
@@ -388,6 +388,7 @@ static int cdb_clear(knot_db_t *db)
         * would lead to the instance detaching from the cache of others,
         * until they reopened cache explicitly or cleared it for some reason.
         */
+#ifndef LMDB_NO_DROP
        {
                MDB_txn *txn = NULL;
                int ret = txn_get(env, &txn, false);
@@ -402,6 +403,7 @@ static int cdb_clear(knot_db_t *db)
                }
                kr_log_info("[cache] clearing error, falling back\n");
        }
+#endif
 
        /* We are about to switch to a different file, so end all txns, to be sure. */
        (void) cdb_sync(db);