Bug 619595

Summary: Upgrading sub suffix under non-normalized suffix disappears
Product: [Retired] 389 Reporter: Noriko Hosoi <nhosoi>
Component: MigrationAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: medium Docs Contact:
Priority: high    
Version: 1.2.6CC: amsharma, rmeggins
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 17:02:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 543590, 639035    
Attachments:
Description Flags
git patch file (master) nkinder: review+

Description Noriko Hosoi 2010-07-29 21:16:14 UTC
Description of problem:
1) Install 389 v1.2.5
2) Create a suffix "dc=example,  dc=com" (space(s) between dc=example and dc=com)
3) Create a sub suffix "dc=sub,dc=example,  dc=com" (backend name subexample)
4) Import entries to "ec=example,  dc=com" and "dc=sub,dc=example,  dc=com" (entry count does not matter)
5) Upgrade to 389 v1.2.6
6) Check /var/log/dirsrv/slapd-ID/errors to see if reindexing sub suffix failed:
[..] upgrade DB - subexample: Start upgradedb.
[..] - WARNING: Import is running with nsslapd-db-private-import-mem on; No other process is allowed to access the database
[..] - reindex subexample: Index buffering enabled with bucket size 100
[..] entryrdn-index - _entryrdn_insert_key: Suffix "dc=example,dc=com" not found: DB_NOTFOUND: No matching key/data pair found(-30988)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[..] - reindex subexample: Error writing entryrdn index (error -30988: DB_NOTFOUND: No matching key/data pair found)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[..] - reindex subexample: Aborting all Reindexing threads...
[..] - reindex subexample: Reindexing threads aborted.
[..] - reindex subexample: Closing files...
[..] - All database threads now stopped
[..] - reindex subexample: Reindexing failed.
[..] upgrade DB - upgradedb: Failed to upgrade database subexample
7) Check the dbdir /var/lib/dirsrv/slapd-ID/db/subexample exists or not:
# ls /var/lib/dirsrv/slapd-ID/db/
DBVERSION  guardian  log.0000000001  NetscapeRoot  NetscapeRoot.orig  userRoot
If exists, check the contents of id2entry.db4 using the dbscan utility.

[Problem description]
On v1.2.5, the sub suffix is created as follows in the configuration file dse.ldif.  The issue is nsslapd-parent-suffix, which contains the raw parent DN including the space(s) between dc=example and dc=com:
 dn: cn="dc=sub,dc=example,  dc=com",cn=mapping tree, cn=config
 objectclass: top
 objectclass: extensibleObject
 objectclass: nsMappingTree
 nsslapd-state: Backend
 cn: "dc=sub,dc=example,  dc=com"
 cn: dc=sub,dc=example,  dc=com
 nsslapd-parent-suffix: "dc=example,  dc=com"
 nsslapd-backend: subexample

When the server starts, mapping tree is constructed using the internal search.  For the sub suffix "dc=sub, dc=example,  dc=com", it's supposed to be found by the search with this filter:
  "(&(objectclass=nsMappingTree) \
    (|(nsslapd-parent-suffix=\"dc=example,dc=com\") \
     (nsslapd-parent-suffix=dc=example,dc=com)))"
For the search to return the dc=sub entry, nsslapd-parent-suffix value should be normalized by DN normalizer.  But since nsslapd-parent-suffix was missing in the schema definitions, it's considered a string and not normalized.  This leaves "dc=sub,dc=example,  dc=com" not putting into the mapping tree, which causes the entryrdn reindex fail.

Comment 2 Noriko Hosoi 2010-07-30 01:08:02 UTC
Created attachment 435442 [details]
git patch file (master)

Fix Description:
The cause of this problem is the config attribute nsslapd-parent-suffix
was not defined as an attribute of DN syntax.  Because of the missing
definition, the value is not the target of the DN normalization and
the match fails after upgraded.  Adding the attribute to the schema
solves this problem.

Plus upgradedb does backup the DB before upgrade, and if it fails
it restores from the backed up DB.  Use dblayer_restore instead
of copying DB files one by one.

Comment 4 Noriko Hosoi 2010-07-30 23:08:29 UTC
Pushed to master:

$ git push
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (20/20), 4.20 KiB, done.
Total 20 (delta 16), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   5ae0c1b..666873d  master -> master

Pushed to 389-ds-base-1.2.6:

$ git push origin ds126-local:389-ds-base-1.2.6
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (20/20), 4.28 KiB, done.
Total 20 (delta 16), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   af5c96e..d67bb39  ds126-local -> 389-ds-base-1.2.6

Comment 5 Noriko Hosoi 2011-07-26 23:56:12 UTC
This bug is supposed to verify in the upgrade test.
On the older version, prepare a suffix which is not normalized, e.g.:
  dc=example,   dc=com
and a sub suffix under it:
  ou=sub,dc=example,  dc=com

Upgrade it to DS9.0.
. Check the error log. The following error should not be observed:
  entryrdn-index - _entryrdn_insert_key: Suffix "dc=example,dc=com" not
  found: DB_NOTFOUND: No matching key/data pair found(-30988)
. The sub suffix ou=sub,dc=example,dc=com should exist after the upgrade.
If these 2 are satisfied, this bug is verified.

Comment 6 Amita Sharma 2011-08-16 09:57:10 UTC
followed comment#5 to test -
1. I have created the sub-suffix on source under dc=example,dc=com as ou=sub,dc=example,dc=com from the console on DS8.2(rhel5)
2. Migrated to DS9.0 on rhel6.1
Upgrade it to DS9.0.
. Check the error log. The following error should not be observed:
  entryrdn-index - _entryrdn_insert_key: Suffix "dc=example,dc=com" not
  found: DB_NOTFOUND: No matching key/data pair found(-30988)
. The sub suffix ou=sub,dc=example,dc=com should exist after the upgrade.
Both are satisfied.

Hence marking the bug as VERIFIED.