I see this symptom too with both these versions:
OpenLDAP 2.4.21, BDB 4.8.26 OpenLDAP 2.4.23, BDB 4.8.30
ldapdelete -r failes with:
ldap_delete: Other (e.g., implementation specific) error (80) additional info: DN index delete failed
I've copied the database files to a similar machine for debugging.
Here's the output for slapd -d1 when doing so: ============================================================= do_bind: SASL/EXTERNAL bind: dn="cn=config" sasl_ssf=0 send_ldap_response: msgid=1 tag=97 err=0 ber_flush2: 14 bytes to sd 11 <== slap_sasl_bind: rc=0 connection_get(11): got connid=1001 connection_read(11): checking for input on id=1001 ber_get_next ber_get_next: tag 0x30 len 86 contents: op tag 0x63, time 1299502775 ber_get_next conn=1001 op=1 do_search ber_scanf fmt ({miiiib) ber:
dnPrettyNormal: <o=xxx,dc=example,dc=com>
<<< dnPrettyNormal: <o=xxx,dc=example,dc=com>, <o=xxx,dc=example,dc=com> ber_scanf fmt (m) ber: ber_scanf fmt ({M}}) ber: => bdb_search bdb_dn2entry("o=xxx,dc=example,dc=com") search_candidates: base="o=xxx,dc=example,dc=com" (0x0025d3ca) scope=1 => bdb_dn2idl("o=xxx,dc=example,dc=com") <= bdb_dn2idl: get failed: DB_NOTFOUND: No matching key/data pair found (-30988) bdb_search_candidates: failed (rc=-30988) bdb_search: no candidates send_ldap_result: conn=1001 op=1 p=3 send_ldap_response: msgid=2 tag=101 err=0 ber_flush2: 14 bytes to sd 11 connection_get(11): got connid=1001 connection_read(11): checking for input on id=1001 ber_get_next ber_get_next: tag 0x30 len 49 contents: op tag 0x4a, time 1299502775 ber_get_next conn=1001 op=2 do_delete ber_scanf fmt (m) ber:
dnPrettyNormal: <o=xxx,dc=example,dc=com>
<<< dnPrettyNormal: <o=xxx,dc=example,dc=com>, <o=xxx,dc=example,dc=com> bdb_dn2entry("o=xxx,dc=example,dc=com") bdb_dn2entry("o=xxx,dc=example,dc=com") bdb_entry_get: rc=0 bdb_dn2entry("o=xxx,dc=example,dc=com") => bdb_dn2id_delete 0x25d3ca: "o=xxx,dc=example,dc=com" => bdb_idl_delete_key: c_get lo failed: DB_BUFFER_SMALL: User memory too small for return value (-30999) => bdb_dn2id_delete 0x25d3ca: subtree (o=xxx,dc=example,dc=com) delete failed: -30999 <= bdb_dn2id_delete 0x25d3ca: -30999 <=- bdb_delete: dn2id failed: DB_BUFFER_SMALL: User memory too small for return value (-30999) send_ldap_result: conn=1001 op=2 p=3 send_ldap_response: msgid=3 tag=107 err=80 ber_flush2: 36 bytes to sd 11 connection_get(11): got connid=1001 connection_read(11): checking for input on id=1001 ber_get_next ber_get_next: tag 0x30 len 5 contents: op tag 0x42, time 1299502775 ber_get_next ber_get_next on fd 11 failed errno=0 (Success) conn=1001 op=3 do_unbind connection_get(11): got connid=1001 connection_get(11): got connid=1001 connection_close: conn=1001 sd=11 =============================================================================
Doing an ldapsearch for the entry takes some time, but does finish. Looking at the -d1 output there's a lot of "bdb_search: <number> scope not okay" messages.
There's about 5 million objects in the database. I only know of this one object on this server which has this problem. I have another server with another object with the same problem. Other objects can be deleted just fine. Looking at the slapcat output, there's only the base "o=xxx" object. There's no subordinate objects to this object.
/Peter