]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10191 back-mdb: check for pool pause in search 696/head
authorHoward Chu <hyc@openldap.org>
Fri, 22 Mar 2024 18:08:50 +0000 (18:08 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 23 Sep 2025 17:30:51 +0000 (17:30 +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 03549a7c3be1d99b20d0c535068f7e1379e3d899..416f227fe636c4a032ec52957c2b1b3a47162f30 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 06b222cdbad2fdfb63e5acbebbbc7ee190aeae5b..a5ff9c127ebc09a8c3bdf0e130523d2634720eaf 100644 (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);
                }
 
index 073e7a33c2ef348a7b83023b2e3d3916e9232e68..e93db060d386a37ddc820265a963e00899ca7459 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 8e0d184e4402555ffdf4041d4e747a49577536b6..a11503fd004466bb91da31f6fda9ce785a49dae0 100644 (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,