ITS#10191 back-mdb: check for pool pause in search

Also related, cancel any ops on a DB that is being deleted.
This commit is contained in:
Howard Chu 2024-03-22 18:08:50 +00:00 committed by Quanah Gibson-Mount
parent 442b2c84f8
commit 5fd86869f3
4 changed files with 34 additions and 0 deletions

View file

@ -416,6 +416,8 @@ mdb_waitfixup( Operation *op, ww_ctx *ww, MDB_cursor *mci, MDB_cursor *mcd, IdSc
return rc;
}
#define PAUSEPOLL 100
int
mdb_search( Operation *op, SlapReply *rs )
{
@ -433,6 +435,7 @@ mdb_search( Operation *op, SlapReply *rs )
int manageDSAit;
int tentries = 0;
int admincheck = 0;
int pausepoll;
IdScopes isc;
MDB_cursor *mci, *mcd;
ww_ctx wwctx;
@ -806,6 +809,7 @@ adminlimit:
id = mdb_idl_first( candidates, &cursor );
}
pausepoll = 0;
while (id != NOID)
{
int scopeok;
@ -813,6 +817,12 @@ adminlimit:
loop_begin:
if ( ++pausepoll == PAUSEPOLL ) {
pausepoll = 0;
if ( ldap_pvt_thread_pool_pausing( &connection_pool ) > 0 )
ldap_pvt_thread_pool_pausewait( &connection_pool );
}
/* check for abandon */
if ( op->o_abandon ) {
rs->sr_err = SLAPD_ABANDON;

View file

@ -6931,6 +6931,7 @@ config_back_delete( Operation *op, SlapReply *rs )
if ( ce->ce_be->bd_info->bi_db_close ) {
ce->ce_be->bd_info->bi_db_close( ce->ce_be, NULL );
}
connections_drop_db( ce->ce_be );
backend_destroy_one( ce->ce_be, 1);
}

View file

@ -254,6 +254,28 @@ void connections_drop()
connection_done( c );
}
/* Drop all ops for given database */
void connections_drop_db( BackendDB *be )
{
Operation *o;
Connection* c;
ber_socket_t connindex;
BackendDB *rbe = be->bd_self;
for( c = connection_first( &connindex );
c != NULL;
c = connection_next( c, &connindex ) )
{
for ( o = LDAP_STAILQ_FIRST( &c->c_ops ); o; o = LDAP_STAILQ_NEXT( o, o_next )) {
if ( o->o_bd && o->o_bd->bd_self == rbe ) {
o->o_abandon = 1;
o->o_cancel = 1;
}
}
}
connection_done( c );
}
static Connection* connection_get( ber_socket_t s )
{
Connection *c;

View file

@ -757,6 +757,7 @@ LDAP_SLAPD_F (int) connections_shutdown LDAP_P((void));
LDAP_SLAPD_F (int) connections_destroy LDAP_P((void));
LDAP_SLAPD_F (int) connections_timeout_idle LDAP_P((time_t));
LDAP_SLAPD_F (void) connections_drop LDAP_P((void));
LDAP_SLAPD_F (void) connections_drop_db LDAP_P(( BackendDB *be ));
LDAP_SLAPD_F (Connection *) connection_client_setup LDAP_P((
ber_socket_t s,