From d7933e2ea4bca1855028e7fc832ece85c1896269 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 28 Jan 2012 11:52:09 -0800 Subject: [PATCH] ITS#7140 more cleanup on txn abort --- servers/slapd/back-mdb/tools.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/servers/slapd/back-mdb/tools.c b/servers/slapd/back-mdb/tools.c index 78e1e36b98..12fba8c368 100644 --- a/servers/slapd/back-mdb/tools.c +++ b/servers/slapd/back-mdb/tools.c @@ -679,9 +679,13 @@ done: } } else { + unsigned i; mdb_txn_abort( txn ); txn = NULL; - cursor = NULL; + idcursor = NULL; + for ( i=0; imi_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; imi_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; imi_nattrs; i++ ) + mi->mi_attrs[i]->ai_cursor = NULL; Debug( LDAP_DEBUG_ANY, "=> " LDAP_XSTRING(mdb_tool_entry_reindex) ": txn_aborted! err=%d\n", -- 2.39.5