Re: DB backend support for lmdb?
Steffen Nurpmeso <[email protected]> Thu, 19 Jul 2018 01:10:52 +0200
| Newsgroups | gmane.mail.bogofilter.devel |
|---|---|
| Message-ID | <20180718231052.mqDYm%[email protected]> |
Hello. Steffen Nurpmeso wrote in <20180718150719.FCFgf%[email protected]>: |Steffen Nurpmeso wrote in <20180717235921.8OO-E%[email protected]>: ||Matthias Andree wrote in <[email protected]>: |||Am 18.07.2018 um 01:19 schrieb Matthias Andree: ... |||...make that r7065. | |So below what i have now, i cannot make it crash no more, while ... |Both modes have three failing tests cases into which i will look |this evening: t.bogodir, t.encoding and t.bogoutil. But then, if |i implement a real db_created(), which is still somehow faked, as |we just do not and cannot know whether we have created the file or |not, the i get failing tests t.encoding, t.maint and t.regtest. | |I think this is in parts a problem of bogofilter, if i looked ... The thing is, if i change bogofilter to not use db_created() at all, with the snippet below, then tests behave differently -- even though this should essentially be the same, right? (Except for performance, maybe.) I then have a failed t.encoding, t.nonascii.replace, t.maint, t.regtest, t.upgrade.subnet.prefix. But the LMDB DBs actually do contain the .WORDLIST_VERSION, and i think that is what is desired. I mean, i have no idea, but check_wordlist_version() in maint.c is not prepared for the other case, "for example". I do not yet know at all what is wrong with t.encoding. P.S.: the patch i sent this afternoon has messy a_BFLM_MINSIZE and a_BFLM_GROW constants (with debug comments and such), it should simply be # define a_BFLM_MINSIZE (1u << 21) # define a_BFLM_GROW (1u << 23) # define a_BFLM_GROW_TRIES 3 i would say. diff --git a/bogofilter/src/datastore.c b/bogofilter/src/datastore.c index 8644fa5..0dcc00c 100644 --- a/bogofilter/src/datastore.c +++ b/bogofilter/src/datastore.c @@ -161,16 +161,22 @@ void *ds_open(void *dbe, bfpath *bfp, dbmode_t open_mode) dsh = dsh_init(v); - if (db_created(v) && ! (open_mode & DS_LOAD) && (open_mode & DS_WRITE)) { + if (/*db_created(v) &&*/ ! (open_mode & DS_LOAD) && (open_mode & DS_WRITE)) { + dsv_t val; + if (DST_OK != ds_txn_begin(dsh)) exit(EX_ERROR); - ds_set_wordlist_version(dsh, NULL); - /* enforce use of default value */ - if (encoding == E_UNKNOWN) - encoding = E_DEFAULT; + if(ds_get_wordlist_version(dsh, &val) != 0){ + ds_set_wordlist_version(dsh, NULL); + + /* enforce use of default value */ + if (encoding == E_UNKNOWN) + encoding = E_DEFAULT; + + ds_set_wordlist_encoding(dsh, (int) encoding); + } - ds_set_wordlist_encoding(dsh, (int) encoding); if (DST_OK != ds_txn_commit(dsh)) exit(EX_ERROR); } --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) _______________________________________________ bogofilter-dev mailing list [email protected] https://www.bogofilter.org/mailman/listinfo/bogofilter-dev