Browse Source

Bug 567282 - server can not abandon searchRequest of "simple paged results"

https://bugzilla.redhat.com/show_bug.cgi?id=567282

Description: Simple Paged Results search keeps the connection
per paging, but not an operation.  When an abandon request is
issued, the operation referred by the request has already finished.
This patch introduces pagedresults_cleanup function to check
whether the connection is for the simple paged results or not, and
if it is, the simple paged results is cleaned up.  If it is not,
pagedresults_cleanup does nothing.  The function is called from
do_abandon as well as from connection_cleanup.
Noriko Hosoi 15 years ago
parent
commit
33245d123c

+ 6 - 1
ldap/servers/slapd/abandon.c

@@ -152,7 +152,12 @@ do_abandon( Slapi_PBlock *pb )
 		    0 );
 	}
 
-	if ( NULL == o ) {
+	if (pagedresults_cleanup(pb->pb_conn)) {
+		/* Cleaned up paged result connection */
+		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
+			" targetop=Simple Paged Results\n",
+			pb->pb_conn->c_connid, pb->pb_op->o_opid );
+	} else if ( NULL == o ) {
 		slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
 			" targetop=NOTFOUND msgid=%d\n",
 			pb->pb_conn->c_connid, pb->pb_op->o_opid, id );

+ 1 - 10
ldap/servers/slapd/connection.c

@@ -200,16 +200,7 @@ connection_cleanup(Connection *conn)
 	/* destroy any sasl context */
 	sasl_dispose((sasl_conn_t**)&conn->c_sasl_conn);
 	/* PAGED_RESULTS */
-	if (conn->c_search_result_set) {
-		if (conn->c_current_be->be_search_results_release) {
-			conn->c_current_be->be_search_results_release(&(conn->c_search_result_set));
-		}
-		conn->c_search_result_set = NULL;
-	}
-	conn->c_current_be = NULL;
-	conn->c_search_result_count = 0;
-	conn->c_timelimit = 0;
-	/* PAGED_RESULTS ENDS */
+	pagedresults_cleanup(conn);
 
 	/* free the connection socket buffer */
 	connection_free_private_buffer(conn);

+ 1 - 1
ldap/servers/slapd/opshared.c

@@ -866,7 +866,7 @@ next_be:
     rc = 0;
   }
 
- free_and_return:
+free_and_return:
   if ((be_list[0] != NULL) || (referral_list[0] != NULL))
     slapi_mapping_tree_free_all(be_list, referral_list);
   else if (be_single)

+ 24 - 0
ldap/servers/slapd/pagedresults.c

@@ -363,3 +363,27 @@ pagedresults_set_timelimit(Connection *conn, time_t timelimit)
     return rc;
 }
 
+/*
+ * return values
+ * 0: not a simple paged result connection
+ * 1: simple paged result and successfully abandoned
+ */
+int
+pagedresults_cleanup(Connection *conn)
+{
+    int rc = 0;
+
+    if (conn->c_current_be) {
+        if (conn->c_search_result_set) {
+            if (conn->c_current_be->be_search_results_release) {
+                conn->c_current_be->be_search_results_release(&(conn->c_search_result_set));
+            }
+            conn->c_search_result_set = NULL;
+        }
+        conn->c_current_be = 0;
+        conn->c_search_result_count = 0;
+        conn->c_timelimit = 0;
+        rc = 1;
+    }
+    return rc;
+}

+ 1 - 0
ldap/servers/slapd/proto-slap.h

@@ -1379,6 +1379,7 @@ int pagedresults_set_unindexed(Connection *conn);
 int pagedresults_get_sort_result_code(Connection *conn);
 int pagedresults_set_sort_result_code(Connection *conn, int code);
 int pagedresults_set_timelimit(Connection *conn, time_t timelimit);
+int pagedresults_cleanup(Connection *conn);
 
 /*
  * sort.c