andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame 0246-Ticket-47874-Performance-degradation-with-scope-ONE-.patch

dc8c34
From 091b588f5b38b0f3e44c69ff69c1d6fa53870ece Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Thu, 14 Aug 2014 17:54:30 -0700
dc8c34
Subject: [PATCH 246/251] Ticket #47874 - Performance degradation with scope
dc8c34
 ONE after some load
dc8c34
dc8c34
Bug Description: Backend has a bit to indicate "should not bypass
dc8c34
the filter test".  It's set if one of the search results is ALLID
dc8c34
in idl_intersection.  Once the flag is set, it's never been unset.
dc8c34
It makes the following one level searches slow down.
dc8c34
dc8c34
Fix Description: Introduced slapi_be_unset_flag and unset the bit
dc8c34
at the end of every search.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47874
dc8c34
dc8c34
Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
dc8c34
dc8c34
(cherry picked from commit 8e1345ab9276d1cf9c9ac2cbd858c398235ef5ce)
dc8c34
(cherry picked from commit 3ff6d520ae0a15f74dc57122837627b5b73de629)
dc8c34
(cherry picked from commit caddfa2d0d16357b41bf6ccccd0d8b655ae60b2a)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_search.c |  5 +++++
dc8c34
 ldap/servers/slapd/backend.c               | 11 ++++++++---
dc8c34
 ldap/servers/slapd/slapi-plugin.h          |  1 +
dc8c34
 3 files changed, 14 insertions(+), 3 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
index 09c29c4..b5ba89c 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
@@ -181,6 +181,11 @@ ldbm_back_search_cleanup(Slapi_PBlock *pb,
dc8c34
 
dc8c34
     slapi_pblock_get( pb, SLAPI_BACKEND, &be );
dc8c34
     inst = (ldbm_instance *) be->be_instance_info;
dc8c34
+    /* 
dc8c34
+     * In case SLAPI_BE_FLAG_DONT_BYPASS_FILTERTEST is set, 
dc8c34
+     * clean it up for the following sessions.
dc8c34
+     */
dc8c34
+    slapi_be_unset_flag(be, SLAPI_BE_FLAG_DONT_BYPASS_FILTERTEST);
dc8c34
     CACHE_RETURN(&inst->inst_cache, &e); /* NULL e is handled correctly */
dc8c34
 
dc8c34
     if(sort_control!=NULL)
dc8c34
diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c
dc8c34
index de852c8..d4fc580 100644
dc8c34
--- a/ldap/servers/slapd/backend.c
dc8c34
+++ b/ldap/servers/slapd/backend.c
dc8c34
@@ -559,13 +559,18 @@ slapi_be_setentrypoint(Slapi_Backend *be, int entrypoint, void *ret_fnptr, Slapi
dc8c34
 }
dc8c34
 
dc8c34
 int slapi_be_is_flag_set(Slapi_Backend * be, int flag)
dc8c34
-{ 
dc8c34
+{
dc8c34
     return be->be_flags & flag;
dc8c34
 }
dc8c34
 
dc8c34
 void slapi_be_set_flag(Slapi_Backend * be, int flag)
dc8c34
-{ 
dc8c34
-    be->be_flags|= flag;
dc8c34
+{
dc8c34
+    be->be_flags |= flag;
dc8c34
+}
dc8c34
+
dc8c34
+void slapi_be_unset_flag(Slapi_Backend * be, int flag)
dc8c34
+{
dc8c34
+    be->be_flags &= ~flag;
dc8c34
 }
dc8c34
 
dc8c34
 char * slapi_be_get_name(Slapi_Backend * be)
dc8c34
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
dc8c34
index 34962e2..8fff870 100644
dc8c34
--- a/ldap/servers/slapd/slapi-plugin.h
dc8c34
+++ b/ldap/servers/slapd/slapi-plugin.h
dc8c34
@@ -6051,6 +6051,7 @@ const char * slapi_be_gettype(Slapi_Backend *be);
dc8c34
 
dc8c34
 int slapi_be_is_flag_set(Slapi_Backend * be, int flag);
dc8c34
 void slapi_be_set_flag(Slapi_Backend * be, int flag);
dc8c34
+void slapi_be_unset_flag(Slapi_Backend * be, int flag);
dc8c34
 #define SLAPI_BE_FLAG_REMOTE_DATA   0x1  /* entries held by backend are remote */
dc8c34
 #define SLAPI_BE_FLAG_DONT_BYPASS_FILTERTEST   0x10  /* force to call filter_test (search only) */
dc8c34
 
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34