diff options
author | Andrew Bartlett <abartlet@samba.org> | 2017-03-30 13:25:35 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-05-31 06:34:27 +0200 |
commit | e7c36a7142198c9a8efb769627af4488e0bb5dc0 (patch) | |
tree | 8848d0e3b0e4d0514cc3535b0f76d0bd3d67c1ef | |
parent | 13e09c72cd41cd5cd44bd9e4e27df8e0e1d47379 (diff) | |
download | samba-e7c36a7142198c9a8efb769627af4488e0bb5dc0.tar.gz |
schema: Use ldb_schema_set_override_indexlist for faster index selection
This allows Samba to provide a binary tree lookup for the existance of an index on the attribute
rather than the O(n) lookup that was being done for each attribute during a search or modify
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
-rw-r--r-- | source4/dsdb/schema/schema_init.c | 4 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_set.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 256c4677452..c76b57cb4a9 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -514,6 +514,10 @@ static int dsdb_schema_setup_ldb_schema_attribute(struct ldb_context *ldb, a->flags |= LDB_ATTR_FLAG_SINGLE_VALUE; } + if (attr->searchFlags & SEARCH_FLAG_ATTINDEX) { + a->flags |= LDB_ATTR_FLAG_INDEXED; + } + return LDB_SUCCESS; } diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index d3e3cc8f55b..e6d5ce627ce 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -71,6 +71,7 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb, /* setup our own attribute name to schema handler */ ldb_schema_attribute_set_override_handler(ldb, dsdb_attribute_handler_override, schema); + ldb_schema_set_override_indexlist(ldb, true); if (!write_indices_and_attributes) { return ret; |