Bug 513916 - Server doesn't ignore paged control, if page size and server's estimate of total no of entries are same
Summary: Server doesn't ignore paged control, if page size and server's estimate of to...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Directory Server
Classification: Red Hat
Component: Directory Server
Version: 9.0
Hardware: All
OS: Linux
high
medium
Target Milestone: ---
: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks: 434914 389_1.2.1
TreeView+ depends on / blocked
 
Reported: 2009-07-27 05:33 UTC by Sankar Ramalingam
Modified: 2016-05-06 14:43 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-06 14:43:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
git patch file (3.57 KB, patch)
2009-08-04 17:43 UTC, Noriko Hosoi
no flags Details | Diff
git patch file (a correct one...) (22.59 KB, patch)
2009-08-04 18:47 UTC, Noriko Hosoi
no flags Details | Diff

Description Sankar Ramalingam 2009-07-27 05:33:20 UTC
Description of problem: simple paged control which is equal to page size returned is not returning to the shell prompt. Paged control prompt even though there are no entries to be returned.

How reproducible: Consistently


Steps to Reproduce:
1. Add few entries to Directory server.
2. Write a simple paged search with page control which is equal to the no of entries returned by server.
3. Observe the prompt.

For Eg: no of entries returned for the search is 6. Write a paged request as below.
./ldapsearch.pl -x -pg 6 "cn=test*" "cn sn" -S "sn"
  

Actual results: Server doesn't ignore the paged control even the request can be satisfied in a single page.


Expected results: Server should ignore the paged control if the page size is equal to paged control.


Additional info:

Comment 1 Noriko Hosoi 2009-08-04 17:43:37 UTC
Created attachment 356215 [details]
git patch file

[Files]
   ldap/servers/plugins/chainingdb/cb.h
   ldap/servers/plugins/chainingdb/cb_init.c
   ldap/servers/plugins/chainingdb/cb_search.c
   ldap/servers/slapd/back-ldbm/idl_common.c
   ldap/servers/slapd/back-ldbm/idl_new.c
   ldap/servers/slapd/back-ldbm/init.c
   ldap/servers/slapd/back-ldbm/ldbm_search.c
   ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
   ldap/servers/slapd/backend.c
   ldap/servers/slapd/backend_manager.c
   ldap/servers/slapd/dl.c
   ldap/servers/slapd/dse.c
   ldap/servers/slapd/opshared.c
   ldap/servers/slapd/pblock.c
   ldap/servers/slapd/proto-slap.h
   ldap/servers/slapd/slap.h
   ldap/servers/slapd/slapi-private.h

[Fix Description]
The code processing search results were returning the PAGE END without knowing
there are more entries to return or not.  To learn it, introduced "read ahead"
one entry when it comes to the PAGE END.  If there are more entries, the code
undo the read ahead, which prompts for the next page on the client side.
If there is no more entries, it returns the status SEARCH END instead of PAGE
END.

In addition to the read ahead implementation to fix the bug 513916,
* supporting Simple Paged Results for chaining backend is added.
* fixed a bug in idl_new_fetch (idl_new.c) -- idlistscanlimit was not checked
  when the cursor comes to the end of an index file.

Comment 2 Noriko Hosoi 2009-08-04 18:45:28 UTC
(In reply to comment #1)
> Created an attachment (id=356215) [details]
> git patch file

Sorry, a wrong patch... :(

Comment 3 Noriko Hosoi 2009-08-04 18:47:25 UTC
Created attachment 356229 [details]
git patch file (a correct one...)

Comment 4 Noriko Hosoi 2009-08-04 20:04:39 UTC
Reviewed by Nathan (Thank you !!)

Pushed to master.

$ git merge paged
Updating cbed8a2..0565e8c
Fast forward
 ldap/servers/plugins/chainingdb/cb.h           |    3 +
 ldap/servers/plugins/chainingdb/cb_init.c      |    4 +
 ldap/servers/plugins/chainingdb/cb_search.c    |   40 +++++++++++++
 ldap/servers/slapd/back-ldbm/idl_common.c      |    4 +-
 ldap/servers/slapd/back-ldbm/idl_new.c         |    9 +--
 ldap/servers/slapd/back-ldbm/init.c            |    2 +
 ldap/servers/slapd/back-ldbm/ldbm_search.c     |   16 +++++
 ldap/servers/slapd/back-ldbm/proto-back-ldbm.h |    1 +
 ldap/servers/slapd/backend.c                   |    6 ++
 ldap/servers/slapd/backend_manager.c           |    1 +
 ldap/servers/slapd/dl.c                        |   13 ++++
 ldap/servers/slapd/dse.c                       |   12 ++++
 ldap/servers/slapd/opshared.c                  |   71 +++++++++++++----------
 ldap/servers/slapd/pblock.c                    |   12 ++++
 ldap/servers/slapd/proto-slap.h                |    2 +-
 ldap/servers/slapd/slap.h                      |    3 +
 ldap/servers/slapd/slapi-private.h             |    2 +
 17 files changed, 163 insertions(+), 38 deletions(-)

$ git push
Counting objects: 49, done.
Delta compression using 4 threads.
Compressing objects: 100% (25/25), done.
Writing objects: 100% (25/25), 4.21 KiB, done.
Total 25 (delta 23), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   cbed8a2..0565e8c  master -> master

Comment 5 Jenny Severance 2010-05-17 15:48:37 UTC
verified - RHEL 4

version:
redhat-ds-base-8.2.0-2010051204.el4dsrv

subtree searched contains 4 users

# perl ./ldapsearch.pl -x -pg 2 "(uid=test*)" "dn sn"
dn: uid=test1,ou=Special Users,dc=example,dc=com
sn: test

dn: uid=test2,ou=Special Users,dc=example,dc=com
sn: test2
next page size (2): 

dn: uid=test3,ou=Special Users,dc=example,dc=com
sn: test3

dn: uid=test4,ou=Special Users,dc=example,dc=com
sn: test4



# perl ./ldapsearch.pl -x -pg 4 "(uid=test*)" "dn sn"
dn: uid=test1,ou=Special Users,dc=example,dc=com
sn: test

dn: uid=test2,ou=Special Users,dc=example,dc=com
sn: test2

dn: uid=test3,ou=Special Users,dc=example,dc=com
sn: test3

dn: uid=test4,ou=Special Users,dc=example,dc=com
sn: test4


Note You need to log in before you can comment on or make changes to this bug.