mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
Enabled deletion of stale index entries. (EXPERIMENTAL)
This commit is contained in:
parent
e1819eaff9
commit
5b0e434d93
1 changed files with 48 additions and 1 deletions
|
|
@ -193,7 +193,54 @@ delete_value(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
return 0;
|
int rc;
|
||||||
|
Datum key;
|
||||||
|
/* XXX do we need idl ??? */
|
||||||
|
ID_BLOCK *idl = NULL;
|
||||||
|
char *tmpval = NULL;
|
||||||
|
char *realval = val;
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
|
char prefix = index2prefix( indextype );
|
||||||
|
|
||||||
|
ldbm_datum_init( key );
|
||||||
|
|
||||||
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
|
"=> delete_value( \"%c%s\" )\n",
|
||||||
|
prefix, val, 0 );
|
||||||
|
|
||||||
|
if ( prefix != UNKNOWN_PREFIX ) {
|
||||||
|
unsigned int len = strlen( val );
|
||||||
|
|
||||||
|
if ( (len + 2) < sizeof(buf) ) {
|
||||||
|
realval = buf;
|
||||||
|
} else {
|
||||||
|
/* value + prefix + null */
|
||||||
|
tmpval = (char *) ch_malloc( len + 2 );
|
||||||
|
realval = tmpval;
|
||||||
|
}
|
||||||
|
realval[0] = prefix;
|
||||||
|
strcpy( &realval[1], val );
|
||||||
|
}
|
||||||
|
|
||||||
|
key.dptr = realval;
|
||||||
|
key.dsize = strlen( realval ) + 1;
|
||||||
|
|
||||||
|
rc = idl_delete_key( be, db, key, id );
|
||||||
|
|
||||||
|
if ( tmpval != NULL ) {
|
||||||
|
free( tmpval );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( idl != NULL ) {
|
||||||
|
idl_free( idl );
|
||||||
|
}
|
||||||
|
|
||||||
|
ldap_pvt_thread_yield();
|
||||||
|
|
||||||
|
Debug( LDAP_DEBUG_TRACE, "<= delete_value %d\n", rc, 0, 0 );
|
||||||
|
|
||||||
|
return( rc );
|
||||||
|
|
||||||
}/* static int delete_value() */
|
}/* static int delete_value() */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue