summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2008-11-05 23:49:58 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2008-11-05 23:49:58 +0000
commit3f81ba7e1623d249f4bc599e14fdf9217b7b6df2 (patch)
tree70553737ff2aeea0d3454363116d976bc3c264a6
parent16c994ace5d2eb635bf3847b5fe4c96c46fdd8a2 (diff)
downloadds-3f81ba7e1623d249f4bc599e14fdf9217b7b6df2.tar.gz
ds-3f81ba7e1623d249f4bc599e14fdf9217b7b6df2.tar.xz
ds-3f81ba7e1623d249f4bc599e14fdf9217b7b6df2.zip
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.
-rw-r--r--ldap/servers/slapd/back-ldbm/ldif2ldbm.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index bf4fbdc6..d26cc4c7 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -687,8 +687,16 @@ static IDList *ldbm_fetch_subtrees(backend *be, char **include, int *err)
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 @@ static IDList *ldbm_fetch_subtrees(backend *be, char **include, int *err)
*/
*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 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
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. */