]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
test/journal: enable 64k (and other weird) page size
authorLibor Peltan <libor.peltan@nic.cz>
Tue, 3 Aug 2021 20:07:19 +0000 (22:07 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 5 Aug 2021 06:15:11 +0000 (08:15 +0200)
tests/knot/test_journal.c

index 3e2025cb3684576474e3690e6b0aa5694fc6b84b..ca79b0a794f92657b59b7c08cb17033029382f45 100644 (file)
@@ -44,6 +44,16 @@ zone_journal_t jj;
 
 unsigned env_flag;
 
+static unsigned lmdb_page_size(knot_lmdb_db_t *db)
+{
+       knot_lmdb_txn_t txn = { 0 };
+       knot_lmdb_begin(db, &txn, false);
+       MDB_stat st = { 0 };
+       mdb_stat(txn.txn, txn.db->dbi, &st);
+       knot_lmdb_abort(&txn);
+       return st.ms_psize;
+}
+
 static void set_conf(int zonefile_sync, size_t journal_usage, const knot_dname_t *apex)
 {
        (void)apex;
@@ -708,7 +718,7 @@ static void test_merge(const knot_dname_t *apex)
        list_t l;
 
        // allow merge
-       set_conf(-1, 100 * 1024, apex);
+       set_conf(-1, 400 * 1024, apex);
        ok(!journal_allow_flush(jj), "journal: merge allowed");
 
        ret = journal_scrape_with_md(jj, false);
@@ -761,7 +771,7 @@ static void test_merge(const knot_dname_t *apex)
        // now fill up with dumy changesets to enforce merge
        tm_chs(apex, -1);
        while (changeset_to(tm_chs(apex, 0)) != 2) {  }
-       for (i = 0; i < 400; i++) {
+       for (i = 0; i < 1600; i++) {
                ret = journal_insert(jj, tm_chs(apex, i), NULL);
                assert(ret == KNOT_EOK);
        }
@@ -853,7 +863,9 @@ int main(int argc, char *argv[])
 
        test_store_load(apex);
 
-       test_size_control(apex, apex2);
+       if (lmdb_page_size(&jdb) == 4096) {
+               test_size_control(apex, apex2);
+       } // else it is not manually optimized enough to test correctly
 
        test_merge(apex);