ldb: Intersect the index from SCOPE_ONELEVEL with the index for the search expression
authorAndrew Bartlett <abartlet@samba.org>
Mon, 18 Dec 2017 03:22:01 +0000 (16:22 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 Dec 2017 03:22:09 +0000 (04:22 +0100)
commitef240aaca0ef693a96726ac2366c454294b87b96
treee6326c109cbb482d0f181066d97c1da8874edab4
parent44eee9ce9e9818df8387b2b3782504408112f12c
ldb: Intersect the index from SCOPE_ONELEVEL with the index for the search expression

This helps ensure we do not have to scan all objects at this level
which could be very many (one per DNS zone entry).

However, due to the O(n*m) behaviour in list_intersect() for older
databases, we only do this in the GUID index mode, leaving the behaviour
unchanged for existing callers that do not specify the GUID index mode.

NOTE WELL: the behaviour of disallowDNFilter is enforced
in the index code, so this fixes SCOPE_ONELEVEL to also
honour disallowDNFilter, hence the additional tests.

The change to select the SUBTREE index in the absense of
the ONELEVEL index enforces this.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13191

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
lib/ldb/ldb_tdb/ldb_index.c
lib/ldb/tests/python/api.py