From 344996c5e8a2194a65de7a861bf11a07ca7d1670 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 18 Sep 2011 14:28:36 -0700 Subject: [PATCH] Support index truncation --- servers/slapd/back-mdb/attr.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/servers/slapd/back-mdb/attr.c b/servers/slapd/back-mdb/attr.c index 14e67d884e..842456c5f1 100644 --- a/servers/slapd/back-mdb/attr.c +++ b/servers/slapd/back-mdb/attr.c @@ -133,6 +133,20 @@ mdb_attr_dbs_open( cr->msg, 0, 0 ); break; } + if (slapMode & SLAP_TRUNCATE_MODE) { + rc = mdb_drop( txn, mdb->mi_attrs[i]->ai_dbi, 0 ); + if ( rc ) { + snprintf( cr->msg, sizeof(cr->msg), "database \"%s\": " + "mdb_drop(%s) failed: %s (%d).", + be->be_suffix[0].bv_val, + mdb->mi_attrs[i]->ai_desc->ad_type->sat_cname.bv_val, + mdb_strerror(rc), rc ); + Debug( LDAP_DEBUG_ANY, + LDAP_XSTRING(mdb_attr_dbs) ": %s\n", + cr->msg, 0, 0 ); + break; + } + } } /* Only commit if this is our txn */