[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm ancestorid.c, 1.7, 1.8

Noriko Hosoi nhosoi at fedoraproject.org
Thu Jan 15 22:44:42 UTC 2009


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv960

Modified Files:
	ancestorid.c 
Log Message:
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.



Index: ancestorid.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ancestorid.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ancestorid.c	3 Dec 2008 19:14:18 -0000	1.7
+++ ancestorid.c	15 Jan 2009 22:44:40 -0000	1.8
@@ -455,35 +455,38 @@
 
         /* 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) {




More information about the Fedora-directory-commits mailing list