From a1a63bead025b4ec09fb7c903bba8ef8571dcb87 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 8 Oct 2007 01:15:49 +0000 Subject: [PATCH] ITS#4188 check for pool pause every 64 entries. (probably should make this number tunable.) --- include/ldap_pvt_thread.h | 1 + libraries/libldap_r/tpool.c | 4 ++++ servers/slapd/result.c | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/include/ldap_pvt_thread.h b/include/ldap_pvt_thread.h index 4d6a9d4294..151756d692 100644 --- a/include/ldap_pvt_thread.h +++ b/include/ldap_pvt_thread.h @@ -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, diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index fa1d2ae462..6884f32fc3 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -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; diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 4368bf8e4a..c3e3861590 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -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 -- 2.39.5