[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm ldif2ldbm.c, 1.20, 1.21

Noriko Hosoi nhosoi at fedoraproject.org
Wed Nov 5 23:50:01 UTC 2008


Author: nhosoi

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

Modified Files:
	ldif2ldbm.c 
Log Message:
Resolves: #469792
Summary: vlvindex should not give an error message when the vlvindex is empty
Fix description: In ldbm_fetch_subtrees, if the parent entry to be vlvindexed
('ou=payroll,dc=example,dc=com' in this example) does not exist, then vlvindex
with the proposed code issues this warning but no further messages.
  warning: entrydn not indexed on 'ou=payroll,dc=example,dc=com';  entry ou=payroll,dc=example,dc=com may not be added to the database yet.

If the parent entry exists (entry id 10 in this example), but no descendant
entries to be vlvindexed do not, then vlvindex with the proposed code issues
this warning but no further messages.
  warning: ancestorid not indexed on 10;  possibly, the entry id 10 has no descendants yet. 



Index: ldif2ldbm.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldif2ldbm.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ldif2ldbm.c	17 Oct 2008 16:54:47 -0000	1.20
+++ ldif2ldbm.c	5 Nov 2008 23:49:58 -0000	1.21
@@ -687,8 +687,16 @@
         bv.bv_len = strlen(include[i]);
         idl = index_read(be, "entrydn", indextype_EQUALITY, &bv, txn, err);
         if (idl == NULL) {
-            LDAPDebug(LDAP_DEBUG_ANY, "warning: entrydn not indexed on '%s'\n",
-                      include[i], 0, 0);
+            if (DB_NOTFOUND == *err) {
+                LDAPDebug(LDAP_DEBUG_ANY,
+                    "warning: entrydn not indexed on '%s'; "
+                    "entry %s may not be added to the database yet.\n",
+                    include[i], include[i], 0);
+                *err = 0; /* not a problem */
+            } else {
+                LDAPDebug(LDAP_DEBUG_ANY,
+                    "warning: entrydn not indexed on '%s'\n", include[i], 0, 0);
+            }
             continue;
         }
         id = idl_firstid(idl);
@@ -700,8 +708,17 @@
          */
         *err = ldbm_ancestorid_read(be, txn, id, &idl);
         if (idl == NULL) {
-            LDAPDebug(LDAP_DEBUG_ANY, "warning: ancestorid not indexed on %lu\n",
-                      id, 0, 0);
+            if (DB_NOTFOUND == *err) {
+                LDAPDebug(LDAP_DEBUG_ANY,
+                    "warning: ancestorid not indexed on %lu; "
+                    "possibly, the entry id %lu has no descendants yet.\n",
+                    id, id, 0);
+                *err = 0; /* not a problem */
+            } else {
+                LDAPDebug(LDAP_DEBUG_ANY,
+                    "warning: ancestorid not indexed on %lu\n",
+                    id, 0, 0);
+            }
             continue;
         }
 
@@ -1474,20 +1491,23 @@
         idl = ldbm_fetch_subtrees(be, suffix_list, &err);
         charray_free(suffix_list);
         if (! idl) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            /* most likely, indexes are bad if err is set. */
+            if (0 != err) {
+                LDAPDebug(LDAP_DEBUG_ANY,
                       "%s: WARNING: Failed to fetch subtree lists: (%d) %s\n",
                       inst->inst_name, err, dblayer_strerror(err));
-            LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY,
                       "%s: Possibly the entrydn or ancestorid index is "
                       "corrupted or does not exist.\n", inst->inst_name, 0, 0);
-            LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY,
                       "%s: Attempting brute-force method instead.\n",
                       inst->inst_name, 0, 0);
-            if (task) {
-                slapi_task_log_notice(task,
-                    "%s: WARNING: Failed to fetch subtree lists (err %d) -- "
-                    "attempting brute-force method instead.", 
-                    inst->inst_name, err);
+                if (task) {
+                    slapi_task_log_notice(task,
+                      "%s: WARNING: Failed to fetch subtree lists (err %d) -- "
+                      "attempting brute-force method instead.", 
+                      inst->inst_name, err);
+                }
             }
         } else if (ALLIDS(idl)) {
             /* that's no help. */




More information about the Fedora-directory-commits mailing list