python tests broken (Re: s4:samldb LDB module - "member" trigger)

Matthias Dieter Wallnöfer mdw at
Wed Nov 3 09:12:33 MDT 2010


I like your patch - please merge it!


Stefan (metze) Metzmacher wrote:
> Hi,
>> Metze mentioned this patch to me on IRC as he chases down some
>> performance issues, and I wanted to comment on it.  He may make further
>> comments once he finishes pinning down his issue.
>> The problem I have with the patch is that it seems very inefficient, and
>> I wondered if you had considered the O() notation complexity of this
>> validation.
>> For every member being added, you now do a search on the entry for that
>> member, rather than just let ldb_tdb complain about the duplicate
>> attribute when we eventually store it.  Why is this?  If an member
>> attribute gains 100 members, you now do 100 searches of the DB just to
>> check that they are not already there.  The cost of that search is
>> rougly proportional to the number of members already being added -
>> particularly if done one at at a time, so this seems to be O(n^2).
>> And similarly, whey trying to determine if the member attribute would
>> conflict with a primaryGroupID, why not first (and only once) read the
>> sid of the entry, and then compare with the primaryGroupID of the
>> target?
>> Surely this would be faster than dereferencing the member attribute,
>> only to form up a SID and compare it with our own DN?
> I fixed the problem, but I can't verify my changes with make test.
> I discovered that 21 of 30 python tests are broken, currently!
> The piping through filter-subunit just ignores the errors...
> This patch add the logic to let us notice the errors again.
> Most tests fail with:
> [25/30 in 1m46s, 18 errors] samba4.ldap.acl.python(fl2008r2dc)
> Traceback (most recent call last):
>    File
> "/home/metze/devel/samba/4.0/master4-drsuapi/source4/dsdb/tests/python/",
> line 12, in<module>
>      samba.ensure_external_module("subunit", "subunit/python")
>    File
> "/home/metze/devel/samba/4.0/master4-drsuapi/source4/bin/python/samba/",
> line 319, in ensure_external_module
>      __import__(modulename)
>    File
> "/home/metze/devel/samba/4.0/master4-drsuapi/source4/bin/python/samba/../../../../lib/subunit/python/subunit/",
> line 128, in<module>
>      from testtools import content, content_type, ExtendedToOriginalDecorator
> ImportError: No module named testtools
> Jelmer can please take a look at this and fix it?
> metze

More information about the samba-technical mailing list