Bug 469792

Summary: vlvindex should not give an error message when the vlvindex is empty
Product: [Retired] 389 Reporter: Noriko Hosoi <nhosoi>
Component: Database - Indexes/SearchesAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED CURRENTRELEASE QA Contact: Chandrasekar Kannan <ckannan>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.1.3CC: benl, jgalipea, rmeggins
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 8.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-29 23:07:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 249650, 493682    
Attachments:
Description Flags
cvs diff ldap/servers/slapd/back-ldbm/ldif2ldbm.c
none
cvs commit message none

Description Noriko Hosoi 2008-11-04 02:20:27 UTC
Description of problem:
vlvindex should not give an error message - either its a real error (not sure why) or the error message is spurious and should not be printed by default 

Steps to reproduce the problem:
1) Add these entries:
dn: cn=roomNumber ou=Payroll dc=example dc=com, cn=userRoot, cn=ldbm database, cn=plugins, cn=config
objectClass: top
objectClass: vlvSearch
cn: roomNumber  ou=Payroll dc=example dc=com
vlvBase: ou=Payroll, dc=example,dc=com
vlvScope: 2
vlvFilter: (objectclass=*)

dn: cn=by roomNumber,cn=roomNumber ou=Payroll dc=example dc=com, cn=userRoot, cn=ldbm database, cn=plugins, cn=config
objectClass: top
objectClass: vlvIndex
cn: by roomNumber
vlvSort: roomNumber

2) shutdown the server
3) vlvindex -n userRoot -T "by roomNumber ou=Accounting dc=example dc=com"
[03/Nov/2008:18:16:05 -0800] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[03/Nov/2008:18:16:05 -0800] - dblayer_instance_start: pagesize: 4096, pages: 1015077, procpages: 45632
[03/Nov/2008:18:16:05 -0800] - cache autosizing: import cache: 204800k 
[03/Nov/2008:18:16:05 -0800] - li_import_cache_autosize: 50, import_pages: 51200, pagesize: 4096
[03/Nov/2008:18:16:05 -0800] - userRoot: Indexing VLV: by roomNumber
[03/Nov/2008:18:16:05 -0800] - warning: entrydn not indexed on 'ou=payroll,dc=example,dc=com'
[03/Nov/2008:18:16:05 -0800] - userRoot: WARNING: Failed to fetch subtree lists: (-30989) DB_NOTFOUND: No matching key/data pair found
[03/Nov/2008:18:16:05 -0800] - userRoot: Possibly the entrydn or ancestorid index is corrupted or does not exist.
[03/Nov/2008:18:16:05 -0800] - userRoot: Attempting brute-force method instead.
[03/Nov/2008:18:16:05 -0800] - userRoot: Finished indexing.
[03/Nov/2008:18:16:05 -0800] - All database threads now stopped

Comment 1 Noriko Hosoi 2008-11-04 23:18:41 UTC
3) vlvindex -n userRoot -T "by roomNumber ou=Accounting dc=example dc=com"
should be
3) vlvindex -n userRoot -T "by roomNumber"

Comment 2 Noriko Hosoi 2008-11-05 02:17:28 UTC
Created attachment 322519 [details]
cvs diff ldap/servers/slapd/back-ldbm/ldif2ldbm.c

File: ldap/servers/slapd/back-ldbm/ldif2ldbm.c

Fix description: 
In ldbm_fetch_subtrees (ldif2ldbm.c), if the parent entry to be vlvindexed ('ou=payroll,dc=example,dc=com' in this example) does not exist, then vlvindex with the proposed code issues this warning but no further messages.
  warning: entrydn not indexed on 'ou=payroll,dc=example,dc=com'; 
  entry ou=payroll,dc=example,dc=com may not be added to the database yet.

If the parent entry exists (entry id 10 in this example), but no descendant entries to be vlvindexed do not, then vlvindex with the proposed code issues this warning but no further messages.
  warning: ancestorid not indexed on 10; 
  possibly, the entry id 10 has no descendants yet.

Comment 3 Noriko Hosoi 2008-11-05 02:24:45 UTC
Test case 1.
1) Add these entries (make sure no "ou=payroll, dc=example, dc=com" does not exist)
dn: cn=roomNumber ou=Payroll dc=example dc=com, cn=userRoot, cn=ldbm database,
cn=plugins, cn=config
objectClass: top
objectClass: vlvSearch
cn: roomNumber  ou=Payroll dc=example dc=com
vlvBase: ou=Payroll, dc=example,dc=com
vlvScope: 2
vlvFilter: (objectclass=*)

dn: cn=by roomNumber,cn=roomNumber ou=Payroll dc=example dc=com, cn=userRoot,
cn=ldbm database, cn=plugins, cn=config
objectClass: top
objectClass: vlvIndex
cn: by roomNumber
vlvSort: roomNumber

2) shutdown the server
3) vlvindex -n userRoot -T "by roomNumber"
[...]
[..] - userRoot: Indexing VLV: by roomnumber
[..] - warning: entrydn not indexed on 'ou=payroll,dc=ex
ample,dc=com'; entry ou=payroll,dc=example,dc=com may not be added to the databa
se yet.
[..] - userRoot: Finished indexing.
[..] - libdb: userRoot/vlv#byroomnumber.db4: unable to f
lush: No such file or directory
[..] - All database threads now stopped

Comment 4 Noriko Hosoi 2008-11-05 02:30:50 UTC
Test case 2.
1) Add these entries:
dn: cn=roomNumber ou=Payroll dc=example dc=com, cn=userRoot, cn=ldbm database,
cn=plugins, cn=config
objectClass: top
objectClass: vlvSearch
cn: roomNumber  ou=Payroll dc=example dc=com
vlvBase: ou=Payroll, dc=example,dc=com
vlvScope: 2
vlvFilter: (objectclass=*)

dn: cn=by roomNumber,cn=roomNumber ou=Payroll dc=example dc=com, cn=userRoot,
cn=ldbm database, cn=plugins, cn=config
objectClass: top
objectClass: vlvIndex
cn: by roomNumber
vlvSort: roomNumber

2) add an entry ou=payroll, dc=example, dc=com (make sure no child entries exist under ou=payroll, dc=example, dc=com)
3) shutdown the server
4) vlvindex -n userRoot -T "by roomNumber"
[...]
[..] - userRoot: Indexing VLV: by roomnumber
[..] - warning: ancestorid not indexed on 10; possibly, the entry id 10 has no descendants yet.
[..] - userRoot: Finished indexing.

Comment 5 Noriko Hosoi 2008-11-05 23:51:12 UTC
Created attachment 322655 [details]
cvs commit message

Reviewed by Rich (Thank you!!)

Checked in into CVS HEAD.

Comment 6 Jenny Severance 2009-04-01 19:29:59 UTC
fix verified DS 8.1 RHEL 4

Test 1:

[root@jennyv4 slapd-jennyv4]# ./vlvindex -n userRoot -T "by roomNumber"
[01/Apr/2009:15:28:33 -0400] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[01/Apr/2009:15:28:36 -0400] - dblayer_instance_start: pagesize: 4096, pages: 128583, procpages: 7028
[01/Apr/2009:15:28:36 -0400] - cache autosizing: import cache: 204800k 
[01/Apr/2009:15:28:36 -0400] - li_import_cache_autosize: 50, import_pages: 51200, pagesize: 4096
[01/Apr/2009:15:28:36 -0400] - userRoot: Indexing VLV: by roomNumber
[01/Apr/2009:15:28:36 -0400] - info: entrydn not indexed on 'ou=payroll,dc=example,dc=com'; entry ou=payroll,dc=example,dc=com may not be added to the database yet.
[01/Apr/2009:15:28:36 -0400] - userRoot: Finished indexing.
[01/Apr/2009:15:28:36 -0400] - libdb: userRoot/vlv#byroomnumber.db4: unable to flush: No such file or directory
[01/Apr/2009:15:28:36 -0400] - All database threads now stopped


Test 2:

[root@jennyv4 slapd-jennyv4]# ./vlvindex -n userRoot -T "by roomNumber"
[01/Apr/2009:15:31:02 -0400] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[01/Apr/2009:15:31:02 -0400] - dblayer_instance_start: pagesize: 4096, pages: 128583, procpages: 7021
[01/Apr/2009:15:31:02 -0400] - cache autosizing: import cache: 204800k 
[01/Apr/2009:15:31:02 -0400] - li_import_cache_autosize: 50, import_pages: 51200, pagesize: 4096
[01/Apr/2009:15:31:02 -0400] - userRoot: Indexing VLV: by roomNumber
[01/Apr/2009:15:31:02 -0400] - warning: ancestorid not indexed on 10; possibly, the entry id 10 has no descendants yet.
[01/Apr/2009:15:31:02 -0400] - userRoot: Finished indexing.
[01/Apr/2009:15:31:02 -0400] - All database threads now stopped

Comment 7 Chandrasekar Kannan 2009-04-29 23:07:30 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-0455.html