]> git.sur5r.net Git - openldap/commitdiff
tool_reindex now regenerates the dn2id index as well as the others.
authorHoward Chu <hyc@openldap.org>
Wed, 5 Dec 2001 01:36:18 +0000 (01:36 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 5 Dec 2001 01:36:18 +0000 (01:36 +0000)
servers/slapd/back-bdb/tools.c
servers/slapd/back-ldbm/tools.c

index 2738bf10eef546913b2ff70c10646472bdb0897f..8514c15ec8b4f93d6f7bb8eaf735700e58b1573a 100644 (file)
@@ -229,8 +229,18 @@ int bdb_tool_entry_reindex(
        Debug( LDAP_DEBUG_TRACE, "=> bdb_tool_entry_reindex( %ld, \"%s\" )\n",
                (long) id, e->e_dn, 0 );
 
+       /* add dn2id indices */
+       rc = bdb_dn2id_add( be, tid, e->e_ndn, e->e_id );
+       if( rc != 0 ) {
+               Debug( LDAP_DEBUG_ANY,
+                       "=> bdb_tool_entry_reindex: dn2id_add failed: %s (%d)\n",
+                       db_strerror(rc), rc, 0 );
+               goto done;
+       }
+
        rc = bdb_index_entry_add( be, tid, e, e->e_attrs );
 
+done:
        if( bi->bi_txn ) {
                if( rc == 0 ) {
                        rc = txn_commit( tid, 0 );
@@ -250,6 +260,5 @@ int bdb_tool_entry_reindex(
                }
        }
 
-done:
        return rc;
 }
index 226db043a6718979b93ef50abfe2bf66ad3f7ac2..52f0e205c5f37e3bb61c8519d77c9a8e481f56ea 100644 (file)
@@ -271,8 +271,10 @@ int ldbm_tool_entry_reindex(
                id, e->e_dn, 0 );
 #endif
 
-
-       rc = index_entry_add( be, e, e->e_attrs );
+       rc = dn2id_add( be, e->e_ndn, e->e_id );
+       if( rc == 0 ) {
+               rc = index_entry_add( be, e, e->e_attrs );
+       }
 
        entry_free( e );