summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb/ldb_cache.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-10-21 22:21:26 +1100
committerAndrew Tridgell <tridge@samba.org>2009-10-22 12:47:53 +1100
commit859cf72692f7daecbecb80559ebccc0d44087365 (patch)
tree9ed75d633d6b56def03efcd1b9fc874644ca6c73 /source4/lib/ldb/ldb_tdb/ldb_cache.c
parentc5de880c409224889c30837b76fb2fdaf31c02e0 (diff)
downloadsamba-859cf72692f7daecbecb80559ebccc0d44087365.tar.gz
samba-859cf72692f7daecbecb80559ebccc0d44087365.tar.bz2
samba-859cf72692f7daecbecb80559ebccc0d44087365.zip
s4-ldb: ldb indexing rewrite - part1
This gets rid of the @IDXPTR approach to in-transaction indexing, instead using an in-memory tdb to hold index values during a transaction. This also cleans up a lot of the internal indexing logic, hopefully making it easier to understand. One of the big changes is in memory management, with a lot more use made of talloc tricks to avoid copying dn lists, and shortcuts used to avoid high intersection and union calculation costs. The overall result is that a re-provision on my laptop goes from 48s to a bit over 10s.
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_cache.c')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index 2c399686ea..cd2249d4a2 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -357,6 +357,8 @@ int ltdb_cache_load(struct ldb_module *module)
ltdb->cache->attributes == NULL) {
goto failed;
}
+ ltdb->cache->one_level_indexes = false;
+ ltdb->cache->attribute_indexes = false;
indexlist_dn = ldb_dn_new(module, ldb, LTDB_INDEXLIST);
if (indexlist_dn == NULL) goto failed;
@@ -366,6 +368,13 @@ int ltdb_cache_load(struct ldb_module *module)
goto failed;
}
+ if (ldb_msg_find_element(ltdb->cache->indexlist, LTDB_IDXONE) != NULL) {
+ ltdb->cache->one_level_indexes = true;
+ }
+ if (ldb_msg_find_element(ltdb->cache->indexlist, LTDB_IDXATTR) != NULL) {
+ ltdb->cache->attribute_indexes = true;
+ }
+
if (ltdb_attributes_load(module) == -1) {
goto failed;
}