]> git.sur5r.net Git - openldap/commitdiff
ITS#4188 check for pool pause every 64 entries. (probably should make
authorHoward Chu <hyc@openldap.org>
Mon, 8 Oct 2007 01:15:49 +0000 (01:15 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 8 Oct 2007 01:15:49 +0000 (01:15 +0000)
this number tunable.)

include/ldap_pvt_thread.h
libraries/libldap_r/tpool.c
servers/slapd/result.c

index 4d6a9d4294e1015ea5a7266eeeb8bea15be160bb..151756d692a03690537699f3e3f3ec709e6f1af6 100644 (file)
@@ -215,6 +215,7 @@ typedef enum {
        LDAP_PVT_THREAD_POOL_PARAM_OPEN,
        LDAP_PVT_THREAD_POOL_PARAM_STARTING,
        LDAP_PVT_THREAD_POOL_PARAM_ACTIVE,
+       LDAP_PVT_THREAD_POOL_PARAM_PAUSING,
        LDAP_PVT_THREAD_POOL_PARAM_PENDING,
        LDAP_PVT_THREAD_POOL_PARAM_BACKLOAD,
        LDAP_PVT_THREAD_POOL_PARAM_ACTIVE_MAX,
index fa1d2ae4628058114f9d3098b1319e40ad6c8259..6884f32fc3d4d1cb9900dc1981c60f421a823e9f 100644 (file)
@@ -397,6 +397,10 @@ ldap_pvt_thread_pool_query(
                count = pool->ltp_active_count;
                break;
 
+       case LDAP_PVT_THREAD_POOL_PARAM_PAUSING:
+               count = pool->ltp_pause;
+               break;
+
        case LDAP_PVT_THREAD_POOL_PARAM_PENDING:
                count = pool->ltp_pending_count;
                break;
index 4368bf8e4ae170eabfd2032827cf0b0908622185..c3e3861590b8ac4e02d05487795e89fe5939d0dd 100644 (file)
@@ -743,6 +743,13 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
                return LDAP_SIZELIMIT_EXCEEDED;
        }
 
+       /* Every 64 entries, check for thread pool pause */
+       if (( rs->sr_nentries & 0x3f == 0x3f ) &&
+               ldap_pvt_thread_pool_query( &connection_pool,
+                       LDAP_PVT_THREAD_POOL_PARAM_PAUSING, &i ) == 0 && i ) {
+               return LDAP_BUSY;
+       }
+
        rs->sr_type = REP_SEARCH;
 
        /* eventually will loop through generated operational attribute types