ldb_kv: Skip @ records early in a search full scan
authorAndrew Bartlett <abartlet@samba.org>
Thu, 4 Apr 2019 21:46:50 +0000 (10:46 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 10 Apr 2019 06:23:39 +0000 (06:23 +0000)
commit49b77d8df2d7113ac7ddb75e78de6628933ff852
tree0b13d07902780aa190e628f2a5b7ce1d38620a19
parent56f933fa344e1ed4cbaa15b43cc219591e2eca8a
ldb_kv: Skip @ records early in a search full scan

@ records like @IDXLIST are only available via a base search on the specific name
but the method by which they were excluded was expensive, after the unpack the
DN is exploded and ldb_match_msg_error() would reject it for failing to match the
scope.

This uses the fact that @ records have the DN=@ prefix on their TDB/LMDB key
to quickly exclude them from consideration.

Based on analysis by Garming Sam.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr 10 06:23:39 UTC 2019 on sn-devel-144
lib/ldb/ldb_key_value/ldb_kv.c
lib/ldb/ldb_key_value/ldb_kv.h
lib/ldb/ldb_key_value/ldb_kv_index.c
lib/ldb/ldb_key_value/ldb_kv_search.c