summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2009-01-15 22:44:40 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2009-01-15 22:44:40 +0000
commit59a3cc8efdd6ffd129a59df846ef2d9fa44dff0e (patch)
tree842677539ab3686ea2519ed091f2f6651a35fc62
parentdc68782f859c40a89df4060ead477cc39733b4ec (diff)
downloadds-59a3cc8efdd6ffd129a59df846ef2d9fa44dff0e.tar.gz
ds-59a3cc8efdd6ffd129a59df846ef2d9fa44dff0e.tar.xz
ds-59a3cc8efdd6ffd129a59df846ef2d9fa44dff0e.zip
Resolves: #469800
Summary: Slow import post-processing with large number of non-leaf entries (comment #15) Change description: Fixed ldbm_ancestorid_new_idl_create_index so that the ancestor key has the value including all the descendent ids in the IDlist. The code checked in previously only stores the direct children and their children.
-rw-r--r--ldap/servers/slapd/back-ldbm/ancestorid.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/ldap/servers/slapd/back-ldbm/ancestorid.c b/ldap/servers/slapd/back-ldbm/ancestorid.c
index 51647506..c3edea06 100644
--- a/ldap/servers/slapd/back-ldbm/ancestorid.c
+++ b/ldap/servers/slapd/back-ldbm/ancestorid.c
@@ -455,35 +455,38 @@ static int ldbm_ancestorid_new_idl_create_index(backend *be)
/* Insert into ancestorid for this node */
ret = idl_store_block(be, db_aid, &key, children, txn, ai_aid);
- if (ret != 0) {
- idl_free(children);
- break;
- }
-
- /* Get parentid for this entry */
- ret = ldbm_parentid(be, txn, id, &parentid);
if (ret != 0) {
idl_free(children);
break;
}
- /* A suffix entry does not have a parent */
- if (parentid == NOID) {
- idl_free(children);
- continue;
+ /* Get parentid(s) for this entry */
+ while (1) {
+ ret = ldbm_parentid(be, txn, id, &parentid);
+ if (ret != 0) {
+ idl_free(children);
+ goto out;
+ }
+
+ /* A suffix entry does not have a parent */
+ if (parentid == NOID) {
+ idl_free(children);
+ break;
+ }
+
+ /* Reset the key to the parent id */
+ key.size = PR_snprintf(key.data, key.ulen, "%c%lu",
+ EQ_PREFIX, (u_long)parentid);
+ key.size++;
+
+ /* Insert into ancestorid for this node's parent */
+ ret = idl_store_block(be, db_aid, &key, children, txn, ai_aid);
+ if (ret != 0) {
+ idl_free(children);
+ goto out;
+ }
+ id = parentid;
}
-
- /* Reset the key to the parent id */
- key.size = PR_snprintf(key.data, key.ulen, "%c%lu",
- EQ_PREFIX, (u_long)parentid);
- key.size++;
-
- /* Insert into ancestorid for this node's parent */
- ret = idl_store_block(be, db_aid, &key, children, txn, ai_aid);
- idl_free(children);
- if (ret != 0) {
- break;
- }
} while (nids > 0);
if (ret != 0) {