|
|
df9752 |
From 2c5b4ef85d492732050f3bec57eec1b7afbb1120 Mon Sep 17 00:00:00 2001
|
|
|
df9752 |
From: Noriko Hosoi <nhosoi@redhat.com>
|
|
|
df9752 |
Date: Sat, 30 May 2015 16:44:14 -0700
|
|
|
df9752 |
Subject: [PATCH 69/72] Ticket #48146 - async simple paged results issue
|
|
|
df9752 |
|
|
|
df9752 |
Description: commit 5e9c4f1f09596dd076a6c3a0bb419580e8fd705e broke the
|
|
|
df9752 |
CI test case ticket47824_test.py.
|
|
|
df9752 |
|
|
|
df9752 |
If the simple paged results search is operated on a backend having one
|
|
|
df9752 |
or more sub-backends underneath, it fails to pick up the next sub-back
|
|
|
df9752 |
ends, but repeats the search on the parent backend. The problem was
|
|
|
df9752 |
fixed.
|
|
|
df9752 |
|
|
|
df9752 |
https://fedorahosted.org/389/ticket/48146
|
|
|
df9752 |
|
|
|
df9752 |
Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
|
|
|
df9752 |
|
|
|
df9752 |
(cherry picked from commit 03d3455dfbe84f034a234df2ebd8cfdd7ad15f48)
|
|
|
df9752 |
(cherry picked from commit f6fe5bfe4c1fb1402af789a0f935c765c299d103)
|
|
|
df9752 |
---
|
|
|
df9752 |
ldap/servers/slapd/opshared.c | 87 ++++++++++++++++++++-----------------------
|
|
|
df9752 |
1 file changed, 41 insertions(+), 46 deletions(-)
|
|
|
df9752 |
|
|
|
df9752 |
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
|
|
|
df9752 |
index ff67a9b..5dff42f 100644
|
|
|
df9752 |
--- a/ldap/servers/slapd/opshared.c
|
|
|
df9752 |
+++ b/ldap/servers/slapd/opshared.c
|
|
|
df9752 |
@@ -470,46 +470,31 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
|
|
|
df9752 |
}
|
|
|
df9752 |
}
|
|
|
df9752 |
|
|
|
df9752 |
- if (be_name == NULL)
|
|
|
df9752 |
- {
|
|
|
df9752 |
- /* no specific backend was requested, use the mapping tree
|
|
|
df9752 |
- */
|
|
|
df9752 |
- err_code = slapi_mapping_tree_select_all(pb, be_list, referral_list, errorbuf);
|
|
|
df9752 |
- if (((err_code != LDAP_SUCCESS) && (err_code != LDAP_OPERATIONS_ERROR) && (err_code != LDAP_REFERRAL))
|
|
|
df9752 |
- || ((err_code == LDAP_OPERATIONS_ERROR) && (be_list[0] == NULL)))
|
|
|
df9752 |
- {
|
|
|
df9752 |
- send_ldap_result(pb, err_code, NULL, errorbuf, 0, NULL);
|
|
|
df9752 |
- rc = -1;
|
|
|
df9752 |
- goto free_and_return;
|
|
|
df9752 |
- }
|
|
|
df9752 |
- if (be_list[0] != NULL)
|
|
|
df9752 |
- {
|
|
|
df9752 |
- index = 0;
|
|
|
df9752 |
- if (pr_be) { /* PAGED RESULT: be is found from the previous paging. */
|
|
|
df9752 |
- /* move the index in the be_list which matches pr_be */
|
|
|
df9752 |
- while (be_list[index] && be_list[index+1] && pr_be != be_list[index])
|
|
|
df9752 |
- index++;
|
|
|
df9752 |
+ if (be_name == NULL) {
|
|
|
df9752 |
+ /* no specific backend was requested, use the mapping tree
|
|
|
df9752 |
+ */
|
|
|
df9752 |
+ err_code = slapi_mapping_tree_select_all(pb, be_list, referral_list, errorbuf);
|
|
|
df9752 |
+ if (((err_code != LDAP_SUCCESS) && (err_code != LDAP_OPERATIONS_ERROR) && (err_code != LDAP_REFERRAL))
|
|
|
df9752 |
+ || ((err_code == LDAP_OPERATIONS_ERROR) && (be_list[0] == NULL))) {
|
|
|
df9752 |
+ send_ldap_result(pb, err_code, NULL, errorbuf, 0, NULL);
|
|
|
df9752 |
+ rc = -1;
|
|
|
df9752 |
+ goto free_and_return;
|
|
|
df9752 |
+ }
|
|
|
df9752 |
+ if (be_list[0] != NULL) {
|
|
|
df9752 |
+ index = 0;
|
|
|
df9752 |
+ while (be_list[index] && be_list[index+1]) {
|
|
|
df9752 |
+ index++;
|
|
|
df9752 |
+ }
|
|
|
df9752 |
+ be = be_list[index];
|
|
|
df9752 |
} else {
|
|
|
df9752 |
- while (be_list[index] && be_list[index+1])
|
|
|
df9752 |
- index++;
|
|
|
df9752 |
+ be = NULL;
|
|
|
df9752 |
}
|
|
|
df9752 |
- /* "be" is either pr_be or the last backend */
|
|
|
df9752 |
- be = be_list[index];
|
|
|
df9752 |
- }
|
|
|
df9752 |
- else
|
|
|
df9752 |
- be = pr_be?pr_be:NULL;
|
|
|
df9752 |
- }
|
|
|
df9752 |
- else
|
|
|
df9752 |
- {
|
|
|
df9752 |
+ } else {
|
|
|
df9752 |
/* specific backend be_name was requested, use slapi_be_select_by_instance_name
|
|
|
df9752 |
*/
|
|
|
df9752 |
- if (pr_be) {
|
|
|
df9752 |
- be_single = be = pr_be;
|
|
|
df9752 |
- } else {
|
|
|
df9752 |
- be_single = be = slapi_be_select_by_instance_name(be_name);
|
|
|
df9752 |
- }
|
|
|
df9752 |
+ be_single = be = slapi_be_select_by_instance_name(be_name);
|
|
|
df9752 |
if (be_single) {
|
|
|
df9752 |
- slapi_be_Rlock(be_single);
|
|
|
df9752 |
+ slapi_be_Rlock(be_single);
|
|
|
df9752 |
}
|
|
|
df9752 |
be_list[0] = NULL;
|
|
|
df9752 |
referral_list[0] = NULL;
|
|
|
df9752 |
@@ -528,6 +513,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
|
|
|
df9752 |
if ( slapi_control_present (ctrlp, LDAP_CONTROL_PAGEDRESULTS,
|
|
|
df9752 |
&ctl_value, &iscritical) )
|
|
|
df9752 |
{
|
|
|
df9752 |
+ /* be is set only when this request is new. otherwise, prev be is honored. */
|
|
|
df9752 |
rc = pagedresults_parse_control_value(pb, ctl_value, &pagesize, &pr_idx, be);
|
|
|
df9752 |
/* Let's set pr_idx even if it fails; in case, pr_idx == -1. */
|
|
|
df9752 |
slapi_pblock_set(pb, SLAPI_PAGED_RESULTS_INDEX, &pr_idx);
|
|
|
df9752 |
@@ -536,13 +522,24 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
|
|
|
df9752 |
unsigned int opnote = SLAPI_OP_NOTE_SIMPLEPAGED;
|
|
|
df9752 |
op_set_pagedresults(operation);
|
|
|
df9752 |
pr_be = pagedresults_get_current_be(pb->pb_conn, pr_idx);
|
|
|
df9752 |
- pr_search_result = pagedresults_get_search_result(pb->pb_conn,
|
|
|
df9752 |
- operation,
|
|
|
df9752 |
- pr_idx);
|
|
|
df9752 |
- estimate =
|
|
|
df9752 |
- pagedresults_get_search_result_set_size_estimate(pb->pb_conn,
|
|
|
df9752 |
- operation,
|
|
|
df9752 |
- pr_idx);
|
|
|
df9752 |
+ if (be_name) {
|
|
|
df9752 |
+ if (pr_be != be_single) {
|
|
|
df9752 |
+ slapi_be_Unlock(be_single);
|
|
|
df9752 |
+ be_single = be = pr_be;
|
|
|
df9752 |
+ slapi_be_Rlock(be_single);
|
|
|
df9752 |
+ }
|
|
|
df9752 |
+ } else if (be_list[0]) {
|
|
|
df9752 |
+ if (pr_be) { /* PAGED RESULT: be is found from the previous paging. */
|
|
|
df9752 |
+ /* move the index in the be_list which matches pr_be */
|
|
|
df9752 |
+ index = 0;
|
|
|
df9752 |
+ while (be_list[index] && be_list[index+1] && pr_be != be_list[index]) {
|
|
|
df9752 |
+ index++;
|
|
|
df9752 |
+ }
|
|
|
df9752 |
+ be = be_list[index];
|
|
|
df9752 |
+ }
|
|
|
df9752 |
+ }
|
|
|
df9752 |
+ pr_search_result = pagedresults_get_search_result(pb->pb_conn, operation, pr_idx);
|
|
|
df9752 |
+ estimate = pagedresults_get_search_result_set_size_estimate(pb->pb_conn, operation, pr_idx);
|
|
|
df9752 |
if (pagedresults_get_unindexed(pb->pb_conn, operation, pr_idx)) {
|
|
|
df9752 |
opnote |= SLAPI_OP_NOTE_UNINDEXED;
|
|
|
df9752 |
}
|
|
|
df9752 |
@@ -687,7 +684,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
|
|
|
df9752 |
* change ONE-LEVEL searches to BASE
|
|
|
df9752 |
*/
|
|
|
df9752 |
|
|
|
df9752 |
- /* that's mean we only support one suffix per backend */
|
|
|
df9752 |
+ /* that means we only support one suffix per backend */
|
|
|
df9752 |
be_suffix = slapi_be_getsuffix(be, 0);
|
|
|
df9752 |
|
|
|
df9752 |
if (be_list[0] == NULL)
|
|
|
df9752 |
@@ -711,9 +708,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
|
|
|
df9752 |
* In async paged result case, the search result might be released
|
|
|
df9752 |
* by other theads. We need to double check it in the locked region.
|
|
|
df9752 |
*/
|
|
|
df9752 |
- pr_search_result = pagedresults_get_search_result(pb->pb_conn,
|
|
|
df9752 |
- operation,
|
|
|
df9752 |
- pr_idx);
|
|
|
df9752 |
+ pr_search_result = pagedresults_get_search_result(pb->pb_conn, operation, pr_idx);
|
|
|
df9752 |
if (pr_search_result) {
|
|
|
df9752 |
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
|
|
|
df9752 |
rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
|
|
|
df9752 |
--
|
|
|
df9752 |
1.9.3
|
|
|
df9752 |
|