diff options
| author | Noriko Hosoi <nhosoi@redhat.com> | 2009-01-15 22:44:40 +0000 |
|---|---|---|
| committer | Noriko Hosoi <nhosoi@redhat.com> | 2009-01-15 22:44:40 +0000 |
| commit | 59a3cc8efdd6ffd129a59df846ef2d9fa44dff0e (patch) | |
| tree | 842677539ab3686ea2519ed091f2f6651a35fc62 | |
| parent | dc68782f859c40a89df4060ead477cc39733b4ec (diff) | |
| download | ds-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.c | 49 |
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) { |
