amoralej / rpms / 389-ds-base

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

Blame SOURCES/0065-Ticket-48146-async-simple-paged-results-issue-log-pr.patch

df9752
From 01fb4193778aa165070c3a8b4fe2c48e83ce3828 Mon Sep 17 00:00:00 2001
df9752
From: Noriko Hosoi <nhosoi@redhat.com>
df9752
Date: Fri, 1 May 2015 10:50:39 -0700
df9752
Subject: [PATCH 65/72] Ticket #48146 - async simple paged results issue; log
df9752
 pr index
df9752
df9752
Description: When the request is a simple paged results search,
df9752
             log pr index in the access log.
df9752
Sample access log for "getent netgroup <name>":
df9752
  [..] conn=23 op=521 SRCH base="cn=accounts,dc=testrelm,dc=test" scope=2 filter="(&(|(memberOf=ipaUniqueID=3036b6a0-ee18-11e4-b7dd-00215e2032c0,cn=ng,cn=alt,dc=testrelm,dc=test))(objectClass=ipaHost))" attrs="objectClass cn fqdn serverHostName memberOf ipaSshPubKey ipaUniqueID"
df9752
  [..] conn=23 op=521 RESULT err=0 tag=101 nentries=200 etime=0 notes=P pr_idx=3
df9752
df9752
https://fedorahosted.org/389/ticket/48146
df9752
df9752
Reviewed by rmeggins@redhat.com (Thanks, Rich!!)
df9752
df9752
(cherry picked from commit 9eb20d89755160aa916544c7cfce0ad066e538f7)
df9752
---
df9752
 ldap/servers/slapd/result.c | 32 +++++++++++++++++++++++++++++++-
df9752
 1 file changed, 31 insertions(+), 1 deletion(-)
df9752
df9752
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
df9752
index 2198337..226f01c 100644
df9752
--- a/ldap/servers/slapd/result.c
df9752
+++ b/ldap/servers/slapd/result.c
df9752
@@ -1961,6 +1961,9 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
df9752
 	CSN *operationcsn = NULL;
df9752
 	char csn_str[CSN_STRSIZE + 5];
df9752
 	char etime[ETIME_BUFSIZ];
df9752
+	int pr_idx = -1;
df9752
+
df9752
+	slapi_pblock_get(pb, SLAPI_PAGED_RESULTS_INDEX, &pr_idx);
df9752
 
df9752
 	internal_op = operation_is_flag_set( op, OP_FLAG_INTERNAL );
df9752
 
df9752
@@ -2054,7 +2057,34 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
df9752
 		}
df9752
 		slapi_ch_free((void**)&dn;;
df9752
 	} else {
df9752
-		if ( !internal_op )
df9752
+		if (pr_idx > -1)
df9752
+		{
df9752
+			if ( !internal_op )
df9752
+			{
df9752
+				slapi_log_access( LDAP_DEBUG_STATS,
df9752
+								  "conn=%" NSPRIu64 " op=%d RESULT err=%d"
df9752
+								  " tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
df9752
+								  " pr_idx=%d\n",
df9752
+								  op->o_connid, 
df9752
+								  op->o_opid,
df9752
+								  err, tag, nentries, 
df9752
+								  etime, 
df9752
+								  notes_str, csn_str, pr_idx );
df9752
+			}
df9752
+			else
df9752
+			{
df9752
+				slapi_log_access( LDAP_DEBUG_ARGS,
df9752
+								  "conn=%s op=%d RESULT err=%d"
df9752
+								  " tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
df9752
+								  " pr_idx=%d\n",
df9752
+								  LOG_INTERNAL_OP_CON_ID,
df9752
+								  LOG_INTERNAL_OP_OP_ID,
df9752
+								  err, tag, nentries, 
df9752
+								  etime, 
df9752
+								  notes_str, csn_str, pr_idx );
df9752
+			}
df9752
+		}
df9752
+		else if ( !internal_op )
df9752
 		{
df9752
 			slapi_log_access( LDAP_DEBUG_STATS,
df9752
 							  "conn=%" NSPRIu64 " op=%d RESULT err=%d"
df9752
-- 
df9752
1.9.3
df9752