ntdb in Samba?

Jakub Hrozek jakub.hrozek at posteo.se
Sun Mar 15 10:28:17 MDT 2015

> On 15 Mar 2015, at 02:40, Andrew Bartlett <abartlet at samba.org> wrote:
> On Sat, 2015-03-14 at 21:37 +0100, Jakub Hrozek wrote:
>>> On 13 Mar 2015, at 09:27, Andrew Bartlett <abartlet at samba.org> wrote:
>>>> And to be honest, NTDB is technologically an incremental, not
>>>> revolutionary enhancement.  Without the benefit of years of testing
>>>> which TDB has.
>>> I've wondered if you think it might help in ldb?  I've not done the
>>> performance work to understand what (if anything) is 'slow', but have
>>> pondered if backing on ntdb or Howard's lmdb would be worthwhile.
>>> Andrew Bartlett
>> Hi,
>> I've done some work on a mdb-based ldb backend in my spare time:
>> 	https://github.com/jhrozek/samba-ldb-mdb/tree/mdb
> Very interesting!
>> It's by no means complete, but I hope it would be in some time.
>> There's also a big amount of duplication between the tdb and mdb back
>> ends, but I was planning to remove the duplication only when I knew
>> the new backend would be useful. 
> I'm curious:  What made you start this,

Partly because we've seen some performance issues exposed by SSSD, especially when saving large groups and all the graphs that Howard Chu shows on conferences made mdb look worth looking into.

And partly because the mdb based back end seemed like a cool project idea when I heard Simo mention it some time ago :-)

> and do you have any early
> indications of the advantages?

I've only done totally unscientific tests, i.e. run the same ldb code, just once compiled with mdb back end and once with tdb back end. So far mdb is faster, but then again, I haven't implemented all the features. Most importantly, indexes are missing.

If there's any existing performance benchmark, or just a script that I could use, I'll be glad to take a look.

>> Also, even if the mdb back end wasn't accepted by Samba, I think the
>> small fixes in the ldb code, documentation and tests could still be
>> useful.
> Indeed.
>> And while mentioning tests -- would Samba accept unit tests of the ldb
>> API written using cmocka now that cmocka has a subunit output module?
>> As far as I can see, the tests in tree mostly call the CLI ldb
>> utilities, but don't test the API directly. I'm used to cmocka and I
>> like it because it's lightweight yet powerful, but so far I've just
>> added a cmocka-based test for my own code verification, so it would be
>> nice to know if this part of my work could be merged to Samba at all.
> API tests would be very valuable, and I would love to see what cmoka can
> do for this.  I've not looked into this at all, but a real example is
> always the best way to understand a new tool or feature.  

The cmocka.org web page lists the capabilities nicely -- no fork (compared to the check framework for instance), no external dependencies, well tested and supports mocking.

I don't think the ldb tests in my samba tree are the best example they're too simple, but we do have some more involved cmocka tests in SSSD, also combined with ld's __wrap feature:

Check out how the getifaddrs() output is faked for test purposes with will_return() and mock()..I think using the mocking feature allows to test each interface nicely in isolation.

> I do like how
> the cmoka tests look - they remind me very much of a cross between our
> python tests and our better subunit-outputting torture tests.
> Andrew Bartlett
> -- 
> Andrew Bartlett                       http://samba.org/~abartlet/
> Authentication Developer, Samba Team  http://samba.org
> Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

More information about the samba-technical mailing list