From 164e7388788102cd41d66fc07b5e4b9ea38b754d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 20 Feb 2012 17:04:24 -0800 Subject: [PATCH] ITS#7176 fix slapindex -q -t --- servers/slapd/back-mdb/tools.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/servers/slapd/back-mdb/tools.c b/servers/slapd/back-mdb/tools.c index 12fba8c368..10622e08c9 100644 --- a/servers/slapd/back-mdb/tools.c +++ b/servers/slapd/back-mdb/tools.c @@ -764,22 +764,6 @@ int mdb_tool_entry_reindex( mi->mi_nattrs = i; } - if ( slapMode & SLAP_TRUNCATE_MODE ) { - int i; - for ( i=0; i < mi->mi_nattrs; i++ ) { - rc = mdb_drop( txn, mi->mi_attrs[i]->ai_dbi, 0 ); - if ( rc ) { - Debug( LDAP_DEBUG_ANY, - LDAP_XSTRING(mdb_tool_entry_reindex) - ": (Truncate) mdb_drop(%s) failed: %s (%d)\n", - mi->mi_attrs[i]->ai_desc->ad_type->sat_cname.bv_val, - mdb_strerror(rc), rc ); - return -1; - } - } - slapMode ^= SLAP_TRUNCATE_MODE; - } - e = mdb_tool_entry_get( be, id ); if( e == NULL ) { @@ -801,6 +785,22 @@ int mdb_tool_entry_reindex( } } + if ( slapMode & SLAP_TRUNCATE_MODE ) { + int i; + for ( i=0; i < mi->mi_nattrs; i++ ) { + rc = mdb_drop( txi, mi->mi_attrs[i]->ai_dbi, 0 ); + if ( rc ) { + Debug( LDAP_DEBUG_ANY, + LDAP_XSTRING(mdb_tool_entry_reindex) + ": (Truncate) mdb_drop(%s) failed: %s (%d)\n", + mi->mi_attrs[i]->ai_desc->ad_type->sat_cname.bv_val, + mdb_strerror(rc), rc ); + return -1; + } + } + slapMode ^= SLAP_TRUNCATE_MODE; + } + /* * just (re)add them for now * Use truncate mode to empty/reset index databases -- 2.39.5