[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: long time search for non-existent attributs (ITS#2506)



This is a multi-part message in MIME format.

------=_NextPart_000_008D_01C319C9.F0552A60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

> -----Original Message-----
> From: owner-openldap-bugs@OpenLDAP.org
> [mailto:owner-openldap-bugs@OpenLDAP.org]On Behalf Of
extern.hendrik.harms@volkswagen.de

> when I'm seaching for an non-existent attribute the ldap runs
> in heavy load
> and the search will take a long time (> 5 minutes).
> This could happend if there is a small bug in the search statement:

A fix for this is now in CVS HEAD. The corresponding fix is attached below,
can you please apply this patch to your source
servers/slapd/back-bdb/filterindex.c and report back the result? Thanks.
(This patch also includes the fix for ITS#2507.)

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support

------=_NextPart_000_008D_01C319C9.F0552A60
Content-Type: text/plain;
	name="dif.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="dif.txt"

Index: filterindex.c
===================================================================
RCS file: /var/CVSROOT/ldap/servers/slapd/back-bdb/filterindex.c,v
retrieving revision 1.1.1.5
retrieving revision 1.2
diff -u -r1.1.1.5 -r1.2
--- filterindex.c	7 May 2003 21:47:58 -0000	1.1.1.5
+++ filterindex.c	14 May 2003 10:09:56 -0000	1.2
@@ -60,6 +60,11 @@
 	switch ( f->f_choice ) {
 	case SLAPD_FILTER_COMPUTED:
 		switch( f->f_result ) {
+		case SLAPD_COMPARE_UNDEFINED:
+		/* This technically is not the same as FALSE, but it
+		 * certainly will produce no matches.
+		 */
+		/* FALLTHRU */
 		case LDAP_COMPARE_FALSE:
 			BDB_IDL_ZERO( ids );
 			break;
@@ -67,8 +72,6 @@
 				struct bdb_info *bdb = (struct bdb_info *) be->be_private;
 				BDB_IDL_ALL( bdb, ids );
 			} break;
-		case SLAPD_COMPARE_UNDEFINED:
-			break;
 		}
 		break;
 
@@ -325,7 +328,7 @@
 			"returned=%d\n",
 			desc->ad_cname.bv_val, rc, 0 );
 #endif
-		return 0;
+		return rc;
 	}
 
 	if( db == NULL ) {
@@ -339,7 +342,7 @@
 			"<= bdb_presence_candidates: (%s) not indexed\n",
 			desc->ad_cname.bv_val, 0, 0 );
 #endif
-		return 0;
+		return -1;
 	}
 
 	if( prefix.bv_val == NULL ) {
@@ -352,7 +355,7 @@
 			"<= bdb_presence_candidates: (%s) no prefix\n",
 			desc->ad_cname.bv_val, 0, 0 );
 #endif
-		return 0;
+		return -1;
 	}
 
 	rc = bdb_key_read( be, db, NULL, &prefix, ids );
@@ -488,7 +491,7 @@
 			"<= bdb_equality_candidates: (%s) no keys\n",
 			ava->aa_desc->ad_cname.bv_val, 0, 0 );
 #endif
-		return 0;
+		return -1;
 	}
 
 	for ( i= 0; keys[i].bv_val != NULL; i++ ) {
@@ -657,7 +660,7 @@
 			"<= bdb_approx_candidates: (%s) no keys (%s)\n",
 			prefix.bv_val, ava->aa_desc->ad_cname.bv_val, 0 );
 #endif
-		return 0;
+		return -1;
 	}
 
 	for ( i= 0; keys[i].bv_val != NULL; i++ ) {
@@ -820,7 +823,7 @@
 			"<= bdb_substring_candidates: (0x%04lx) no keys (%s)\n",
 			mask, sub->sa_desc->ad_cname.bv_val, 0 );
 #endif
-		return 0;
+		return -1;
 	}
 
 	for ( i= 0; keys[i].bv_val != NULL; i++ ) {
@@ -882,6 +885,6 @@
 		(long) BDB_IDL_FIRST(ids),
 		(long) BDB_IDL_LAST(ids) );
 #endif
-	return( 0 );
+	return( rc );
 }
 

------=_NextPart_000_008D_01C319C9.F0552A60--