[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: back-bdb2 <-> back-ldbm


unfortunately, the code is to some extent equal. That's right.

But I cannot see, how we can change that. The code in back-bdb2 is under
development, so differences between the two backends are not yet settled.
To avoid conflicts, I have moved ALL non-static functions in back-bdb2
into their own name-space, bdb2_ and bdb2i_, respectively. That is the
situation for the moment.

Now, how could you merge certain source files, when functions in those
files will call backend-specific versions of functions that completely
differ from each other ? You had to decide on the functions' name at
run-time, depending in the question, which backend you really use at the
moment. I cannot see, how you could do that, other than by using
call-backs ? You have a mesh of function calls, that must be either
ldbm-type or bdb2-type.

Merging the code of both backends again would also be no alternative.
Unless you really prefer one backend over the other, you had to include
a lot of run-time decision code (not #ifdef, since that compile-time
decision), that would make the implementation much more ugly, I fear.

The bad news here is, that back-ldbm is used for NDBM, GDBM and Berkeley
DB (1.x and 2.x) database engines. So you could hope for all engines
beeing usable in slapd at the same time. But if you have a look to
libraries/libldbm/ldbm.c and include/ldbm.h it's easy to see, that
Berkeley DB really is preferred over the others, once you have it. So
running the others in parallel is a non-possibility, even with the 'old'
back-ldbm. Why not really shut off back-ldbm when you configure
'--with-bdb2' ? This would indeed give the possibility to merge the code

I have discussed that with Kurt already, and he couldn't point to a
clever solution, yet.

If there is any suggestion, let me know.


On Wed, 24 Feb 1999, Hallvard B Furuseth wrote:

> Date: Wed, 24 Feb 1999 10:23:16 +0100 (MET)
> From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
> To: openldap-devel@OpenLDAP.org
> Subject: back-bdb2 <-> back-ldbm
> It looks like a lot of extra work to maintain almost equal code in
> back-ldbm and back-bdb2.  There are already differences that look like
> they ought to be independent of the backend.
> I think back-bdb2 should either be merged back into back-ldbm or merely
> use a lot of the files from back-ldbm.  Most of the differences look
> like they can be handled with macros, something like
>     #if <back-bdb2>
>     # define ldbm_thread_trylock        (void)
>     # define ldbm_start_timing          bdb2i_start_timing
>       ...
>     #else
>     # define ldbm_thread_rdwr_wtrylock  ldap_pvt_thread_rdwr_wtrylock
>     # define ldbm_start_timing          (void)
>       ...
>     #endif
> -- 
> Hallvard


X.500:                                              Tel.:
   Kurt Spanier, Zentrum fuer Datenverarbeitung,      +49 7071 29-70334
   Universitaet Tuebingen, DE
SMTP-Mail:                                          FAX.:
   kurt.spanier@zdv.uni-tuebingen.de                   +49 7071 29-5912
   Dr. Kurt Spanier, Zentrum fuer Datenverarbeitung,
   Universitaet Tuebingen, Waechterstrasse 76, D-72074 Tuebingen
   finger "Kurt Spanier"@x500.uni-tuebingen.de