dsdb: Avoid performance hit if PSOs aren't actually used
authorTim Beale <timbeale@catalyst.net.nz>
Tue, 15 May 2018 02:02:32 +0000 (14:02 +1200)
committerGarming Sam <garming@samba.org>
Wed, 23 May 2018 04:55:32 +0000 (06:55 +0200)
commit3779367329646215065e1608ef065930b581e854
tree6f3da71f17855115cc1f631701742165142227bb
parentb7d1c5aae8530126f1e561911ae3adaa527c189f
dsdb: Avoid performance hit if PSOs aren't actually used

The new PSO code adds some additional overhead in extra lookups. To
avoid penalizing existing setups, we can short-circuit the PSO
processing and return early if there are no actual PSO objects in the
DB. The one-level search should be very quick, and it avoids the need to
do more complicated PSO processing (i.e. expanding the nested groups).

The longer-term plan is to rework the tokenGroups lookup so that it only
gets done once, and the result can then be reused by the resultant-PSO
code (rather than computing the nested-groups again). However, in the
short-term, a slight decrease in performance is the price for any users
that want to deploy PSOs.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
source4/dsdb/samdb/ldb_modules/operational.c