Blame SOURCES/0022-Ticket-47354-Indexed-search-are-logged-with-notes-U-.patch

ba46c7
From 6a4c0e191049414d1ef11da03befd1601fecca51 Mon Sep 17 00:00:00 2001
ba46c7
From: Thierry bordaz (tbordaz) <tbordaz@redhat.com>
ba46c7
Date: Fri, 17 May 2013 11:48:08 +0200
ba46c7
Subject: [PATCH 22/28] Ticket 47354 - Indexed search are logged with 'notes=U' in the access logs
ba46c7
ba46c7
Bug Description:
ba46c7
	In the access log, the flag "notes=U" is present to warn the customer that the provided filter contains not
ba46c7
	indexed components. This flag is set independently of the fact that all entries of the database will be
ba46c7
	evaluated against the filter. So it can not be used to determine if all the entries have been scanned.
ba46c7
	Evaluated all entries is usually a performance hit for large database containing millions of entries.
ba46c7
ba46c7
Fix Description:
ba46c7
	The fix consist to introduce a new flag 'notes=A' at the top level (ldbm_back_search) only when the candidate
ba46c7
	list is ALLID and all entries will be scanned.
ba46c7
	The fix also contains the update of logconv.pl to take into account this change.
ba46c7
ba46c7
https://fedorahosted.org/389/ticket/47354
ba46c7
ba46c7
Reviewed by: Rich Megginson and Mark Reynolds (thanks to you !)
ba46c7
ba46c7
Platforms tested: Fedora 17
ba46c7
ba46c7
Flag Day: no
ba46c7
ba46c7
Doc impact: no
ba46c7
(cherry picked from commit f2b5a975c2268b6e99bf27b45a7380d295807d81)
ba46c7
(cherry picked from commit 15c77ad6e757625cd8a57bb5cde5e8d697bf5b25)
ba46c7
---
ba46c7
 ldap/admin/src/logconv.pl                  |  221 ++++++++++++++++++++++------
ba46c7
 ldap/servers/slapd/back-ldbm/ldbm_search.c |    6 +-
ba46c7
 ldap/servers/slapd/result.c                |    3 +-
ba46c7
 ldap/servers/slapd/slapi-plugin.h          |    1 +
ba46c7
 4 files changed, 187 insertions(+), 44 deletions(-)
ba46c7
ba46c7
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
ba46c7
index 77088ff..8ae72da 100755
ba46c7
--- a/ldap/admin/src/logconv.pl
ba46c7
+++ b/ldap/admin/src/logconv.pl
ba46c7
@@ -157,8 +157,10 @@ print "\nCommand: logconv.pl @ARGV\n\n";
ba46c7
 
ba46c7
 $rootDNBindCount = 0;
ba46c7
 $anonymousBindCount = 0;
ba46c7
-$unindexedSrchCount = 0;
ba46c7
-$vlvNotesCount= 0;
ba46c7
+$unindexedSrchCountNotesA = 0;
ba46c7
+$unindexedSrchCountNotesU = 0;
ba46c7
+$vlvNotesACount= 0;
ba46c7
+$vlvNotesUCount= 0;
ba46c7
 $srchCount = 0;
ba46c7
 $fdTaken = 0;
ba46c7
 $fdReturned = 0;
ba46c7
@@ -254,11 +256,16 @@ $UNBIND_CONN = "$dataLocation/unbindconn.logconv";
ba46c7
 $UNBIND_OP = "$dataLocation/unbindop.logconv";
ba46c7
 $EXT_CONN = "$dataLocation/extconn.logconv";
ba46c7
 $EXT_OP = "$dataLocation/extop.logconv";
ba46c7
-$NOTES_ETIME = "$dataLocation/notesetime.logconv";
ba46c7
-$NOTES_CONN = "$dataLocation/notesconn.logconv";
ba46c7
-$NOTES_OP = "$dataLocation/notesop.logconv";
ba46c7
-$NOTES_TIME = "$dataLocation/notestime.logconv";
ba46c7
-$NOTES_NENTRIES = "$dataLocation/notesnentries.logconv";
ba46c7
+$NOTES_A_ETIME = "$dataLocation/notesAetime.logconv";
ba46c7
+$NOTES_A_CONN = "$dataLocation/notesAconn.logconv";
ba46c7
+$NOTES_A_OP = "$dataLocation/notesAop.logconv";
ba46c7
+$NOTES_A_TIME = "$dataLocation/notesAtime.logconv";
ba46c7
+$NOTES_A_NENTRIES = "$dataLocation/notesAnentries.logconv";
ba46c7
+$NOTES_U_ETIME = "$dataLocation/notesUetime.logconv";
ba46c7
+$NOTES_U_CONN = "$dataLocation/notesUconn.logconv";
ba46c7
+$NOTES_U_OP = "$dataLocation/notesUop.logconv";
ba46c7
+$NOTES_U_TIME = "$dataLocation/notesUtime.logconv";
ba46c7
+$NOTES_U_NENTRIES = "$dataLocation/notesUnentries.logconv";
ba46c7
 $BADPWDCONN = "$dataLocation/badpwdconn.logconv";
ba46c7
 $BADPWDOP = "$dataLocation/badpwdop.logconv";
ba46c7
 $BADPWDIP = "$dataLocation/badpwdip.logconv";
ba46c7
@@ -641,20 +648,22 @@ print "Abandoned Requests:           $abandonCount\n";
ba46c7
 print "Smart Referrals Received:     $referralCount\n";
ba46c7
 print "\n";
ba46c7
 print "VLV Operations:               $vlvCount\n";
ba46c7
-print "VLV Unindexed Searches:       $vlvNotesCount\n";
ba46c7
+print "VLV Unindexed Searches:       $vlvNotesACount\n";
ba46c7
+print "VLV Unindexed Components:     $vlvNotesUCount\n";
ba46c7
 print "SORT Operations:              $vlvSortCount\n";
ba46c7
 print "\n";
ba46c7
 print "Entire Search Base Queries:   $objectclassTopCount\n";
ba46c7
 print "Paged Searches:               $pagedSearchCount\n";
ba46c7
-print "Unindexed Searches:           $unindexedSrchCount\n";
ba46c7
+print "Unindexed Searches:           $unindexedSrchCountNotesA\n";
ba46c7
+print "Unindexed Components:         $unindexedSrchCountNotesU\n";
ba46c7
 if ($verb eq "yes" || $usage =~ /u/){
ba46c7
-	if ($unindexedSrchCount > 0){
ba46c7
+	if ($unindexedSrchCountNotesA > 0){
ba46c7
 		%conn_hash = getHashFromFile($CONN_HASH);
ba46c7
-		@notesConn = getArrayFromFile($NOTES_CONN);
ba46c7
-		@notesOp = getArrayFromFile($NOTES_OP);
ba46c7
-		@notesEtime = getArrayFromFile($NOTES_ETIME);
ba46c7
-		@notesTime = getArrayFromFile($NOTES_TIME);
ba46c7
-		@notesNentries = getArrayFromFile($NOTES_NENTRIES);
ba46c7
+		@notesConn = getArrayFromFile($NOTES_A_CONN);
ba46c7
+		@notesOp = getArrayFromFile($NOTES_A_OP);
ba46c7
+		@notesEtime = getArrayFromFile($NOTES_A_ETIME);
ba46c7
+		@notesTime = getArrayFromFile($NOTES_A_TIME);
ba46c7
+		@notesNentries = getArrayFromFile($NOTES_A_NENTRIES);
ba46c7
 		getInfoArraysFromFile($BASEINFO);
ba46c7
 		@base_val = @fileArray1;
ba46c7
 		@base_conn = @fileArray2;
ba46c7
@@ -720,6 +729,78 @@ if ($verb eq "yes" || $usage =~ /u/){
ba46c7
 		undef @scope_conn;
ba46c7
 		undef @scope_op;	
ba46c7
 	}
ba46c7
+	if ($unindexedSrchCountNotesU > 0){
ba46c7
+		%conn_hash = getHashFromFile($CONN_HASH);
ba46c7
+		@notesConn = getArrayFromFile($NOTES_U_CONN);
ba46c7
+		@notesOp = getArrayFromFile($NOTES_U_OP);
ba46c7
+		@notesEtime = getArrayFromFile($NOTES_U_ETIME);
ba46c7
+		@notesTime = getArrayFromFile($NOTES_U_TIME);
ba46c7
+		@notesNentries = getArrayFromFile($NOTES_U_NENTRIES);
ba46c7
+		getInfoArraysFromFile($BASEINFO);
ba46c7
+		@base_val = @fileArray1;
ba46c7
+		@base_conn = @fileArray2;
ba46c7
+		@base_op = @fileArray3;
ba46c7
+		getInfoArraysFromFile($SCOPEINFO);
ba46c7
+		@scope_val = @fileArray1;
ba46c7
+		@scope_conn = @fileArray2;
ba46c7
+		@scope_op = @fileArray3;
ba46c7
+		getInfoArraysFromFile($FILTERINFO);
ba46c7
+		@filter_val = @fileArray1;
ba46c7
+		@filter_conn = @fileArray2;
ba46c7
+		@filter_op = @fileArray3;
ba46c7
+
ba46c7
+		$notesCount = "1";
ba46c7
+		for ($n = 0; $n <= $#notesEtime; $n++){
ba46c7
+			@alreadyseenDN = ();
ba46c7
+			if($conn_hash{$notesConn[$n]} eq ""){
ba46c7
+				$unindexedIp = "?";
ba46c7
+			} else {
ba46c7
+				$unindexedIp = $conn_hash{$notesConn[$n]};
ba46c7
+			}
ba46c7
+			print "\n  Unindexed Components #".$notesCount."\n"; $notesCount++;
ba46c7
+			print "  -  Date/Time:             $notesTime[$n]\n";
ba46c7
+			print "  -  Connection Number:     $notesConn[$n]\n";
ba46c7
+			print "  -  Operation Number:      $notesOp[$n]\n";
ba46c7
+			print "  -  Etime:                 $notesEtime[$n]\n";
ba46c7
+			print "  -  Nentries:              $notesNentries[$n]\n";
ba46c7
+			print "  -  IP Address:            $unindexedIp\n";
ba46c7
+
ba46c7
+			for ($nnn = 0; $nnn < $baseCount; $nnn++){
ba46c7
+				if ($notesConn[$n] eq $base_conn[$nnn] && $notesOp[$n] eq $base_op[$nnn]){
ba46c7
+					print "  -  Search Base:           $base_val[$nnn]\n";
ba46c7
+					last;
ba46c7
+				}
ba46c7
+			}
ba46c7
+			for ($nnn = 0; $nnn < $scopeCount; $nnn++){
ba46c7
+				if ($notesConn[$n] eq $scope_conn[$nnn] && $notesOp[$n] eq $scope_op[$nnn]){
ba46c7
+					print "  -  Search Scope:          $scope_val[$nnn]\n";
ba46c7
+					last;
ba46c7
+				}
ba46c7
+			}
ba46c7
+			for ($nnn = 0; $nnn < $filterCount; $nnn++){	
ba46c7
+				if ($notesConn[$n] eq $filter_conn[$nnn] && $notesOp[$n] eq $filter_op[$nnn]){
ba46c7
+					print "  -  Search Filter:         $filter_val[$nnn]\n";
ba46c7
+					last;
ba46c7
+				}	
ba46c7
+			}
ba46c7
+		}
ba46c7
+		undef %conn_hash;
ba46c7
+		undef @notesConn;
ba46c7
+		undef @notesOp;
ba46c7
+		undef @notesEtime;
ba46c7
+		undef @notesTime;
ba46c7
+		undef @notesNentries;
ba46c7
+		undef @notesIp;
ba46c7
+		undef @filter_val;
ba46c7
+		undef @filter_conn;
ba46c7
+		undef @filter_op;
ba46c7
+		undef @base_val;
ba46c7
+		undef @base_conn;
ba46c7
+		undef @base_op;
ba46c7
+		undef @scope_val;
ba46c7
+		undef @scope_conn;
ba46c7
+		undef @scope_op;	
ba46c7
+	}
ba46c7
 } # end of unindexed search report
ba46c7
 
ba46c7
 print "\n";
ba46c7
@@ -1276,10 +1357,14 @@ if ($usage =~ /j/i || $verb eq "yes"){
ba46c7
 	%conncount = getCounterHashFromFile($CONNCOUNT);
ba46c7
 	print "\n----- Recommendations -----\n";
ba46c7
 	$recCount = "1";
ba46c7
-	if ($unindexedSrchCount > 0){
ba46c7
+	if ($unindexedSrchCountNotesA > 0){
ba46c7
 		print "\n $recCount.  You have unindexed searches, this can be caused from a search on an unindexed attribute, or your returned results exceeded the allidsthreshold.  Unindexed searches are not recommended. To refuse unindexed searches, switch \'nsslapd-require-index\' to \'on\' under your database entry (e.g. cn=UserRoot,cn=ldbm database,cn=plugins,cn=config).\n";
ba46c7
 		$recCount++;
ba46c7
 	}
ba46c7
+	if ($unindexedSrchCountNotesU > 0){
ba46c7
+		print "\n $recCount.  You have unindexed components, this can be caused from a search on an unindexed attribute, or your returned results exceeded the allidsthreshold.  Unindexed components are not recommended. To refuse unindexed searches, switch \'nsslapd-require-index\' to \'on\' under your database entry (e.g. cn=UserRoot,cn=ldbm database,cn=plugins,cn=config).\n";
ba46c7
+		$recCount++;
ba46c7
+	}
ba46c7
 	if ($conncount{"T1"} > 0){
ba46c7
 		print "\n $recCount.  You have some connections that are are being closed by the idletimeout setting. You may want to increase the idletimeout if it is set low.\n";
ba46c7
 		$recCount++;
ba46c7
@@ -1773,36 +1858,71 @@ sub parseLineNormal
ba46c7
 	if (m/ RESULT err=/ && m/ notes=P/){
ba46c7
 		$pagedSearchCount++;
ba46c7
 	}
ba46c7
+	if (m/ notes=A/){
ba46c7
+		if ($_ =~ /conn= *([0-9]+)/i){
ba46c7
+		        $con = $1;
ba46c7
+		        if ($_ =~ /op= *([0-9]+)/i){ $op = $1;}
ba46c7
+		}
ba46c7
+		for ($i=0; $i <= $vlvCount;$i++){
ba46c7
+		        if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesACount++; $isVlvNotes="1";}
ba46c7
+		}
ba46c7
+		if($isVlvNotes == 0){
ba46c7
+			#  We don't want to record vlv unindexed searches for our regular "bad" 
ba46c7
+			#  unindexed search stat, as VLV unindexed searches aren't that bad
ba46c7
+			$unindexedSrchCountNotesA++;
ba46c7
+			if($reportStats){ inc_stats('notesA',$s_stats,$m_stats); }
ba46c7
+		}
ba46c7
+		if ($usage =~ /u/ || $verb eq "yes"){
ba46c7
+			if ($isVlvNnotes == 0 ){
ba46c7
+		        	if ($_ =~ /etime= *([0-9.]+)/i ){
ba46c7
+		                	writeFile($NOTES_A_ETIME, $1);
ba46c7
+		        	}
ba46c7
+		        	if ($_ =~ /conn= *([0-9]+)/i){
ba46c7
+		                	writeFile($NOTES_A_CONN, $1);
ba46c7
+		        	}
ba46c7
+		        	if ($_ =~ /op= *([0-9]+)/i){
ba46c7
+		                	writeFile($NOTES_A_OP, $1);
ba46c7
+		        	}
ba46c7
+		        	if ($_ =~ / *([0-9a-z:\/]+)/i){
ba46c7
+		                	writeFile($NOTES_A_TIME, $1);
ba46c7
+		        	}
ba46c7
+				if ($_ =~ /nentries= *([0-9]+)/i ){
ba46c7
+					writeFile($NOTES_A_NENTRIES, $1);
ba46c7
+				}
ba46c7
+			}
ba46c7
+		}
ba46c7
+		$isVlvNotes = 0;
ba46c7
+	}
ba46c7
 	if (m/ notes=U/){
ba46c7
 		if ($_ =~ /conn= *([0-9]+)/i){
ba46c7
 		        $con = $1;
ba46c7
 		        if ($_ =~ /op= *([0-9]+)/i){ $op = $1;}
ba46c7
 		}
ba46c7
 		for ($i=0; $i <= $vlvCount;$i++){
ba46c7
-		        if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesCount++; $isVlvNotes="1";}
ba46c7
+		        if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesUCount++; $isVlvNotes="1";}
ba46c7
 		}
ba46c7
 		if($isVlvNotes == 0){
ba46c7
 			#  We don't want to record vlv unindexed searches for our regular "bad" 
ba46c7
 			#  unindexed search stat, as VLV unindexed searches aren't that bad
ba46c7
-			$unindexedSrchCount++;
ba46c7
-			if($reportStats){ inc_stats('notesu',$s_stats,$m_stats); }
ba46c7
+			$unindexedSrchCountNotesU++;
ba46c7
+			if($reportStats){ inc_stats('notesU',$s_stats,$m_stats); }
ba46c7
 		}
ba46c7
 		if ($usage =~ /u/ || $verb eq "yes"){
ba46c7
 			if ($isVlvNnotes == 0 ){
ba46c7
 		        	if ($_ =~ /etime= *([0-9.]+)/i ){
ba46c7
-		                	writeFile($NOTES_ETIME, $1);
ba46c7
+		                	writeFile($NOTES_U_ETIME, $1);
ba46c7
 		        	}
ba46c7
 		        	if ($_ =~ /conn= *([0-9]+)/i){
ba46c7
-		                	writeFile($NOTES_CONN, $1);
ba46c7
+		                	writeFile($NOTES_U_CONN, $1);
ba46c7
 		        	}
ba46c7
 		        	if ($_ =~ /op= *([0-9]+)/i){
ba46c7
-		                	writeFile($NOTES_OP, $1);
ba46c7
+		                	writeFile($NOTES_U_OP, $1);
ba46c7
 		        	}
ba46c7
 		        	if ($_ =~ / *([0-9a-z:\/]+)/i){
ba46c7
-		                	writeFile($NOTES_TIME, $1);
ba46c7
+		                	writeFile($NOTES_U_TIME, $1);
ba46c7
 		        	}
ba46c7
 				if ($_ =~ /nentries= *([0-9]+)/i ){
ba46c7
-					writeFile($NOTES_NENTRIES, $1);
ba46c7
+					writeFile($NOTES_U_NENTRIES, $1);
ba46c7
 				}
ba46c7
 			}
ba46c7
 		}
ba46c7
@@ -2196,7 +2316,8 @@ reset_stats_block
ba46c7
     $stats->{'bind'}=0;
ba46c7
     $stats->{'anonbind'}=0;
ba46c7
     $stats->{'unbind'}=0;
ba46c7
-    $stats->{'notesu'}=0;
ba46c7
+    $stats->{'notesA'}=0;
ba46c7
+    $stats->{'notesU'}=0;
ba46c7
     $stats->{'etime'}=0;
ba46c7
     return;
ba46c7
 }
ba46c7
@@ -2242,13 +2363,14 @@ print_stats_block
ba46c7
 					    $stats->{'bind'},
ba46c7
 					    $stats->{'anonbind'},
ba46c7
 					    $stats->{'unbind'},
ba46c7
-					    $stats->{'notesu'},
ba46c7
+					    $stats->{'notesA'},
ba46c7
+					    $stats->{'notesU'},
ba46c7
 					    $stats->{'etime'}),
ba46c7
 			    		"\n" );
ba46c7
 			} else {
ba46c7
 				$stats->{'fh'}->print(
ba46c7
 			    		"Time,time_t,Results,Search,Add,Mod,Modrdn,Moddn,Compare,Delete,Abandon,".
ba46c7
-			    		"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed,ElapsedTime\n"
ba46c7
+			    		"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed search,Unindexed component,ElapsedTime\n"
ba46c7
 			    	);
ba46c7
 			}
ba46c7
 		}
ba46c7
@@ -2415,11 +2537,16 @@ openDataFiles
ba46c7
 	open($UNBIND_OP, ">$UNBIND_OP") or do { openFailed($!, $UNBIND_OP) };
ba46c7
 	open($EXT_CONN, ">$EXT_CONN") or do { openFailed($!, $EXT_CONN) };
ba46c7
 	open($EXT_OP, ">$EXT_OP") or do { openFailed($!, $EXT_OP) };
ba46c7
-	open($NOTES_ETIME, ">$NOTES_ETIME") or do { openFailed($!, $NOTES_ETIME) };
ba46c7
-	open($NOTES_CONN, ">$NOTES_CONN") or do { openFailed($!, $NOTES_CONN) };
ba46c7
-	open($NOTES_OP, ">$NOTES_OP") or do { openFailed($!, $NOTES_OP) };
ba46c7
-	open($NOTES_TIME, ">$NOTES_TIME") or do { openFailed($!, $NOTES_TIME) };
ba46c7
-	open($NOTES_NENTRIES, ">$NOTES_NENTRIES") or do { openFailed($!, $NOTES_NENTRIES) };
ba46c7
+	open($NOTES_A_ETIME, ">$NOTES_A_ETIME") or do { openFailed($!, $NOTES_A_ETIME) };
ba46c7
+	open($NOTES_A_CONN, ">$NOTES_A_CONN") or do { openFailed($!, $NOTES_A_CONN) };
ba46c7
+	open($NOTES_A_OP, ">$NOTES_A_OP") or do { openFailed($!, $NOTES_A_OP) };
ba46c7
+	open($NOTES_A_TIME, ">$NOTES_A_TIME") or do { openFailed($!, $NOTES_A_TIME) };
ba46c7
+	open($NOTES_A_NENTRIES, ">$NOTES_A_NENTRIES") or do { openFailed($!, $NOTES_A_NENTRIES) };
ba46c7
+	open($NOTES_U_ETIME, ">$NOTES_U_ETIME") or do { openFailed($!, $NOTES_U_ETIME) };
ba46c7
+	open($NOTES_U_CONN, ">$NOTES_U_CONN") or do { openFailed($!, $NOTES_U_CONN) };
ba46c7
+	open($NOTES_U_OP, ">$NOTES_U_OP") or do { openFailed($!, $NOTES_U_OP) };
ba46c7
+	open($NOTES_U_TIME, ">$NOTES_U_TIME") or do { openFailed($!, $NOTES_U_TIME) };
ba46c7
+	open($NOTES_U_NENTRIES, ">$NOTES_U_NENTRIES") or do { openFailed($!, $NOTES_U_NENTRIES) };
ba46c7
 	open($BADPWDCONN, ">$BADPWDCONN")  or do { openFailed($!, $BADPWDCONN) };
ba46c7
 	open($BADPWDOP, ">$BADPWDOP")  or do { openFailed($!, $BADPWDOP) };
ba46c7
 	open($BADPWDIP, ">$BADPWDIP")  or do { openFailed($!, $NADPWDIP) };
ba46c7
@@ -2473,11 +2600,16 @@ closeDataFiles
ba46c7
 	close $UNBIND_OP;
ba46c7
 	close $EXT_CONN;
ba46c7
 	close $EXT_OP;
ba46c7
-	close $NOTES_ETIME;
ba46c7
-	close $NOTES_CONN;
ba46c7
-	close $NOTES_OP;
ba46c7
-	close $NOTES_TIME;
ba46c7
-	close $NOTES_NENTRIES;
ba46c7
+	close $NOTES_A_ETIME;
ba46c7
+	close $NOTES_A_CONN;
ba46c7
+	close $NOTES_A_OP;
ba46c7
+	close $NOTES_A_TIME;
ba46c7
+	close $NOTES_A_NENTRIES;
ba46c7
+	close $NOTES_U_ETIME;
ba46c7
+	close $NOTES_U_CONN;
ba46c7
+	close $NOTES_U_OP;
ba46c7
+	close $NOTES_U_TIME;
ba46c7
+	close $NOTES_U_NENTRIES;
ba46c7
 	close $BADPWDCONN;
ba46c7
 	close $BADPWDOP;
ba46c7
 	close $BADPWDIP;
ba46c7
@@ -2531,11 +2663,16 @@ removeDataFiles
ba46c7
 	unlink $UNBIND_OP;
ba46c7
 	unlink $EXT_CONN;
ba46c7
 	unlink $EXT_OP;
ba46c7
-	unlink $NOTES_ETIME;
ba46c7
-	unlink $NOTES_CONN;
ba46c7
-	unlink $NOTES_OP;
ba46c7
-	unlink $NOTES_TIME;
ba46c7
-	unlink $NOTES_NENTRIES;
ba46c7
+	unlink $NOTES_A_ETIME;
ba46c7
+	unlink $NOTES_A_CONN;
ba46c7
+	unlink $NOTES_A_OP;
ba46c7
+	unlink $NOTES_A_TIME;
ba46c7
+	unlink $NOTES_A_NENTRIES;
ba46c7
+	unlink $NOTES_U_ETIME;
ba46c7
+	unlink $NOTES_U_CONN;
ba46c7
+	unlink $NOTES_U_OP;
ba46c7
+	unlink $NOTES_U_TIME;
ba46c7
+	unlink $NOTES_U_NENTRIES;
ba46c7
 	unlink $BADPWDCONN;
ba46c7
 	unlink $BADPWDOP;
ba46c7
 	unlink $BADPWDIP;
ba46c7
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
ba46c7
index 4b789a2..f70388f 100644
ba46c7
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
ba46c7
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
ba46c7
@@ -869,7 +869,7 @@ ldbm_back_search( Slapi_PBlock *pb )
ba46c7
      * to record that fact.
ba46c7
      */
ba46c7
     if ( NULL != candidates && ALLIDS( candidates )) {
ba46c7
-        unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
ba46c7
+        unsigned int opnote;
ba46c7
         int ri = 0;
ba46c7
         int pr_idx = -1;
ba46c7
 
ba46c7
@@ -892,6 +892,10 @@ ldbm_back_search( Slapi_PBlock *pb )
ba46c7
             }
ba46c7
         }
ba46c7
 
ba46c7
+        slapi_pblock_get( pb, SLAPI_OPERATION_NOTES, &opnote );
ba46c7
+        opnote |= SLAPI_OP_NOTE_FULL_UNINDEXED; /* the full filter leads to an unindexed search */
ba46c7
+        opnote &= ~SLAPI_OP_NOTE_UNINDEXED;     /* this note is useless because FULL_UNINDEXED includes UNINDEXED */
ba46c7
+        slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, NULL );
ba46c7
         slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
ba46c7
         slapi_pblock_get( pb, SLAPI_PAGED_RESULTS_INDEX, &pr_idx );
ba46c7
         pagedresults_set_unindexed( pb->pb_conn, pb->pb_op, pr_idx );
ba46c7
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
ba46c7
index 925be53..bdbfd77 100644
ba46c7
--- a/ldap/servers/slapd/result.c
ba46c7
+++ b/ldap/servers/slapd/result.c
ba46c7
@@ -1617,7 +1617,8 @@ struct slapi_note_map {
ba46c7
 
ba46c7
 static struct slapi_note_map notemap[] = {
ba46c7
 	{ SLAPI_OP_NOTE_UNINDEXED,   "U" },
ba46c7
-	{ SLAPI_OP_NOTE_SIMPLEPAGED, "P" }
ba46c7
+	{ SLAPI_OP_NOTE_SIMPLEPAGED, "P" },
ba46c7
+        { SLAPI_OP_NOTE_FULL_UNINDEXED, "A" }
ba46c7
 };
ba46c7
 
ba46c7
 #define SLAPI_NOTEMAP_COUNT  ( sizeof(notemap) / sizeof(struct slapi_note_map))
ba46c7
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
ba46c7
index bbad2a6..2f2152b 100644
ba46c7
--- a/ldap/servers/slapd/slapi-plugin.h
ba46c7
+++ b/ldap/servers/slapd/slapi-plugin.h
ba46c7
@@ -6751,6 +6751,7 @@ typedef struct slapi_plugindesc {
ba46c7
 #define SLAPI_OPERATION_NOTES			57
ba46c7
 #define SLAPI_OP_NOTE_UNINDEXED		0x01
ba46c7
 #define SLAPI_OP_NOTE_SIMPLEPAGED	0x02
ba46c7
+#define SLAPI_OP_NOTE_FULL_UNINDEXED    0x04
ba46c7
 
ba46c7
 /* Allows controls to be passed before operation object is created */
ba46c7
 #define SLAPI_CONTROLS_ARG			58
ba46c7
-- 
ba46c7
1.7.1
ba46c7