andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From b43454d68fa53799a2fcf80ab00e9377638424cb Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Wed, 29 Apr 2015 17:15:45 -0700
dc8c34
Subject: [PATCH 317/319] Ticket #48146 - async simple paged results issue; log
dc8c34
 pr index
dc8c34
dc8c34
Description: When the request is a simple paged results search,
dc8c34
             log pr index in the access log.
dc8c34
Sample access log for "getent netgroup <name>":
dc8c34
  [..] 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"
dc8c34
  [..] conn=23 op=521 RESULT err=0 tag=101 nentries=200 etime=0 notes=P pr_idx=3
dc8c34
dc8c34
(cherry picked from commit 0bff700c0a50f26819f203772085e440a1fa8c23)
dc8c34
---
dc8c34
 ldap/servers/slapd/result.c | 32 ++++++++++++++++++++++++++++++--
dc8c34
 1 file changed, 30 insertions(+), 2 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
dc8c34
index caf3014..6ed6c55 100644
dc8c34
--- a/ldap/servers/slapd/result.c
dc8c34
+++ b/ldap/servers/slapd/result.c
dc8c34
@@ -1689,7 +1689,10 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
dc8c34
 	int	internal_op;
dc8c34
 	CSN *operationcsn = NULL;
dc8c34
 	char csn_str[CSN_STRSIZE + 5];
dc8c34
-        char etime[ETIME_BUFSIZ];
dc8c34
+	char etime[ETIME_BUFSIZ];
dc8c34
+	int pr_idx = -1;
dc8c34
+
dc8c34
+	slapi_pblock_get(pb, SLAPI_PAGED_RESULTS_INDEX, &pr_idx);
dc8c34
 
dc8c34
 	internal_op = operation_is_flag_set( op, OP_FLAG_INTERNAL );
dc8c34
 
dc8c34
@@ -1784,7 +1787,32 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag,
dc8c34
 								  notes_str, csn_str, dn ? dn : "");
dc8c34
 			}
dc8c34
             slapi_ch_free((void**)&dn;;
dc8c34
-        } else {
dc8c34
+        } else if (pr_idx > -1) {
dc8c34
+			if ( !internal_op )
dc8c34
+			{
dc8c34
+				slapi_log_access( LDAP_DEBUG_STATS,
dc8c34
+								  "conn=%" NSPRIu64 " op=%d RESULT err=%d"
dc8c34
+								  " tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
dc8c34
+								  " pr_idx=%d\n",
dc8c34
+								  op->o_connid, 
dc8c34
+								  op->o_opid,
dc8c34
+								  err, tag, nentries, 
dc8c34
+								  etime, 
dc8c34
+								  notes_str, csn_str, pr_idx );
dc8c34
+			}
dc8c34
+			else
dc8c34
+			{
dc8c34
+				slapi_log_access( LDAP_DEBUG_ARGS,
dc8c34
+								  "conn=%s op=%d RESULT err=%d"
dc8c34
+								  " tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
dc8c34
+								  " pr_idx=%d\n",
dc8c34
+								  LOG_INTERNAL_OP_CON_ID,
dc8c34
+								  LOG_INTERNAL_OP_OP_ID,
dc8c34
+								  err, tag, nentries, 
dc8c34
+								  etime, 
dc8c34
+								  notes_str, csn_str, pr_idx );
dc8c34
+			}
dc8c34
+		} else {
dc8c34
 			if ( !internal_op )
dc8c34
 			{
dc8c34
 				slapi_log_access( LDAP_DEBUG_STATS,
dc8c34
-- 
dc8c34
1.9.3
dc8c34