ldb: Intersect the index from SCOPE_ONELEVEL with the index for the search expression
commit82764c9f3ec35b728c66dddd40b724ce27720a3e
authorAndrew Bartlett <abartlet@samba.org>
Mon, 18 Dec 2017 03:22:01 +0000 (18 16:22 +1300)
committerStefan Metzmacher <metze@samba.org>
Fri, 22 Dec 2017 09:05:07 +0000 (22 10:05 +0100)
tree573c662249e1843a4e49222c850bd0b6832ec539
parent5f515616f4cb1ea1ee7dede1a0d47e6f18c5d1ce
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 ldb
1.2 and earlier, we only do this for small numbers of matches on the
filter tree.

This behaviour will only be for ldb 1.2 and will not be kept
long-term in LDB, versions 1.3.1 and above will instead only
intersect when the GUID index is in use.

NOTE WELL: the behaviour of disallowDNFilter is enforced
in the index code, so this fixes SCOPE_ONELEVEL to also
honour disallowDNFilter if there @IDXONE is enabled.  Again,
this will change again in 1.3.1 and above.

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>
(adapted from ef240aaca0ef693a96726ac2366c454294b87b96 in master)
lib/ldb/ldb_tdb/ldb_index.c