DB backend support for lmdb?
Steffen Nurpmeso
steffen at sdaoden.eu
Thu Jul 19 01:10:52 CEST 2018
Hello.
Steffen Nurpmeso wrote in <20180718150719.FCFgf%steffen at sdaoden.eu>:
|Steffen Nurpmeso wrote in <20180717235921.8OO-E%steffen at sdaoden.eu>:
||Matthias Andree wrote in <9a51593a-a5ce-06f3-6070-af25b1a6db34 at an3e.de>:
|||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)
More information about the bogofilter-dev
mailing list