]> git.sur5r.net Git - openldap/commitdiff
ITS#7140 more cleanup on txn abort
authorHoward Chu <hyc@openldap.org>
Sat, 28 Jan 2012 19:52:09 +0000 (11:52 -0800)
committerHoward Chu <hyc@openldap.org>
Sat, 28 Jan 2012 19:52:09 +0000 (11:52 -0800)
servers/slapd/back-mdb/tools.c

index 78e1e36b98816d66aa308732ca087ae7c51b8d8e..12fba8c368c52f9392e176e5f4f6a068b42d551d 100644 (file)
@@ -679,9 +679,13 @@ done:
                }
 
        } else {
+               unsigned i;
                mdb_txn_abort( txn );
                txn = NULL;
-               cursor = NULL;
+               idcursor = NULL;
+               for ( i=0; i<mdb->mi_nattrs; i++ )
+                       mdb->mi_attrs[i]->ai_cursor = NULL;
+               mdb_writes = 0;
                snprintf( text->bv_val, text->bv_len,
                        "txn_aborted! %s (%d)",
                        rc == LDAP_OTHER ? "Internal error" :
@@ -799,9 +803,7 @@ int mdb_tool_entry_reindex(
 
        /*
         * just (re)add them for now
-        * assume that some other routine (not yet implemented)
-        * will zap index databases
-        *
+        * Use truncate mode to empty/reset index databases
         */
 
        Debug( LDAP_DEBUG_TRACE,
@@ -822,6 +824,7 @@ done:
                        unsigned i;
                        MDB_TOOL_IDL_FLUSH( be, txi );
                        rc = mdb_txn_commit( txi );
+                       mdb_writes = 0;
                        for ( i=0; i<mi->mi_nattrs; i++ )
                                mi->mi_attrs[i]->ai_cursor = NULL;
                        if( rc != 0 ) {
@@ -835,7 +838,11 @@ done:
                }
 
        } else {
+               unsigned i;
+               mdb_writes = 0;
                mdb_txn_abort( txi );
+               for ( i=0; i<mi->mi_nattrs; i++ )
+                       mi->mi_attrs[i]->ai_cursor = NULL;
                Debug( LDAP_DEBUG_ANY,
                        "=> " LDAP_XSTRING(mdb_tool_entry_reindex)
                        ": txn_aborted! err=%d\n",