fixed one-level indexing
authorAndrew Tridgell <tridge@samba.org>
Thu, 28 May 2009 06:10:47 +0000 (16:10 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 28 May 2009 06:10:47 +0000 (16:10 +1000)
one-level indexing was not always effective due to some broken logic
in the indexing code. This change means that if normal indexing fails,
we can still fall back on one-level indexing.

This reduces the number of full unindexed searches in s4 quite a lot

source4/lib/ldb/ldb_tdb/ldb_index.c

index c99c2936d850236720c070fcfe0435b26f0581e7..db0c31572e0f6a3c7a0f4a7f09871de3cd4f2856 100644 (file)
@@ -1121,14 +1121,10 @@ int ltdb_search_indexed(struct ltdb_context *ac)
 
        if (ac->scope != LDB_SCOPE_BASE && idxattr == 1) {
                ret = ltdb_index_dn(ac->module, ac->tree, ltdb->cache->indexlist, dn_list);
-
-               if (ret != LDB_SUCCESS && ret != LDB_ERR_NO_SUCH_OBJECT) {
-                       talloc_free(dn_list);
-                       return ret;
-               }
        }
 
-       if (ac->scope == LDB_SCOPE_ONELEVEL && idxone == 1) {
+       if (ret == LDB_ERR_OPERATIONS_ERROR &&
+           ac->scope == LDB_SCOPE_ONELEVEL && idxone == 1) {
                ret = ltdb_index_dn_one(ac->module, ac->base, dn_list);
        }