]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10191 back-mdb: check for pool pause in search
authorHoward Chu <hyc@openldap.org>
Fri, 22 Mar 2024 18:08:50 +0000 (18:08 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 14 Oct 2025 15:19:59 +0000 (15:19 +0000)
Also related, cancel any ops on a DB that is being deleted.

servers/slapd/back-mdb/search.c
servers/slapd/bconfig.c
servers/slapd/connection.c
servers/slapd/proto-slap.h

index 880aa1ac36319e000319587eb21624d9d27b138f..e411ab2db4ff9dd8236e79fd6dae2ac1b0b3998c 100644 (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;
index f3e52324671a38a6b0cb66191f0d41abb4db3b0a..71d2442185fb4a1ebdebb60906e4b1fc146cb955 100644 (file)
@@ -6868,6 +6868,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);
                }
 
index 717934b55e468c1f5692350fb884f0996445625d..7ff4d0947b1f2c54aa4e88d96c510ec6623f7d6a 100644 (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;
index 084d85266b16df28f1051cac93f181587481272c..0593cbd2b239ace9e7f9e09732fd6341f3745e42 100644 (file)
@@ -752,6 +752,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,