Bug 1109387 - IDL-style can become mismatched during partial restoration
Summary: IDL-style can become mismatched during partial restoration
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: 389-ds-base
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Noriko Hosoi
QA Contact: Sankar Ramalingam
URL:
Whiteboard:
Keywords:
Depends On: 1044212
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-13 19:01 UTC by Noriko Hosoi
Modified: 2014-10-14 07:55 UTC (History)
4 users (show)

(edit)
Cause: There was a bug in partial restoration (bak2db -n <backend>) -- ignoring special indexing compare functions instead always calling the default compare function.

Consequence: The order of the restored index got confused.

Fix: Changed to set the expected compare function when needed.

Result: After running a partial restoration, there is no more indexing problem.
Clone Of: 1044212
(edit)
Last Closed: 2014-10-14 07:55:49 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1385 normal SHIPPED_LIVE 389-ds-base bug fix and enhancement update 2014-10-14 01:27:42 UTC

Description Noriko Hosoi 2014-06-13 19:01:28 UTC
+++ This bug was initially created as a clone of Bug #1044212 +++

This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/47463

When doing a partial/FRI restoration the database files are copied key-by-key.  This is necessary to reset the LSNs so the restored files can merge into the existing DB environment (cf. dblayer_copy_file_resetlsns()) in a recoverable way.

However, dblayer_copy_file_keybykey() does not set the comparison function before calling DB->put(), which means that the restored files will not necessarily be using the proper function.

While all the keys are technically present, indexed searches can still fail to return relevant results because the key order is significant when intersecting the results with the other indices.

How to reproduce:

Backup a database and do a partial restoration.  Use dbscan to compare the key order of the backup vs the restored copy.

#Broken
$ dbscan -r -f <file>
256 512 257 513 258 514 259 515 260 516 261 ...

#Working
$ dbscan -r -f <file>
15 16 17 18 19 20 21 22 23 24 25 26 ...

Comment 1 Noriko Hosoi 2014-06-18 00:54:50 UTC
Steps to reproduce is provided in the original comment.

Regarding the partial restoration, see this doc:
https://access.redhat.com/site/documentation/en-US/Red_Hat_Directory_Server/9.0/html/Configuration_Command_and_File_Reference/Shell_Scripts.html#Shell_Scripts-bak2db_Restore_database_from_backup

To check the dbscan output, a script is provided. (NOTE: you may need to edit the script to adjust the current version)
https://fedorahosted.org/389/attachment/ticket/47463/bakchk.sh

Comment 3 Amita Sharma 2014-08-19 13:06:12 UTC
[root@dhcp201-149 ~]# rpm -qa | grep 389
389-ds-base-libs-1.2.11.15-40.el6.x86_64
389-ds-base-1.2.11.15-40.el6.x86_64

Backup a database
cd /usr/lib64/dirsrv/slapd-dhcp201-149/
[root@dhcp201-149 slapd-dhcp201-149]# ./db2bak
Back up directory: /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05


do a partial restoration
[root@dhcp201-149 slapd-dhcp201-149]# ./bak2db /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05 -n rootdse
[19/Aug/2014:18:26:01 +051800] 389-Directory/1.2.11.15 - debug level: backend (524288)
[19/Aug/2014:18:26:01 +051800] - dblayer_delete_database: skipping instance userRoot
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/parentid.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/parentid.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/parentid.db4
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/cn.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/cn.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/cn.db4
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/objectclass.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/objectclass.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/objectclass.db4
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/entryrdn.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/entryrdn.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/entryrdn.db4
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/uniquemember.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/uniquemember.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/uniquemember.db4
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/ancestorid.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/ancestorid.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/ancestorid.db4
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/numsubordinates.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/numsubordinates.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/numsubordinates.db4
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/aci.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/aci.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/aci.db4
[19/Aug/2014:18:26:01 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/id2entry.db4
[19/Aug/2014:18:26:01 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/id2entry.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/id2entry.db4
[19/Aug/2014:18:26:02 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/nsuniqueid.db4
[19/Aug/2014:18:26:02 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/nsuniqueid.db4 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/nsuniqueid.db4
[19/Aug/2014:18:26:02 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/DBVERSION
[19/Aug/2014:18:26:02 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/DBVERSION to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot/DBVERSION
[19/Aug/2014:18:26:02 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/dse_instance.ldif
[19/Aug/2014:18:26:02 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/dse_instance.ldif to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/dse_instance.ldif
[19/Aug/2014:18:26:02 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/log.0000000001
[19/Aug/2014:18:26:02 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/log.0000000001 to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/log.0000000001
[19/Aug/2014:18:26:02 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/DBVERSION
[19/Aug/2014:18:26:02 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/DBVERSION to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/DBVERSION
[19/Aug/2014:18:26:02 +051800] - Moving file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/dse_index.ldif
[19/Aug/2014:18:26:02 +051800] - Copying /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/dse_index.ldif to /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/dse_index.ldif
[19/Aug/2014:18:26:02 +051800] - Removing file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/userRoot from staging area
[19/Aug/2014:18:26:02 +051800] - Removing file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/log.0000000001 from staging area
[19/Aug/2014:18:26:02 +051800] - Removing file /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak/DBVERSION from staging area
[19/Aug/2014:18:26:03 +051800] - All database threads now stopped
[19/Aug/2014:18:26:03 +051800] - Restore: Removing staging area /var/lib/dirsrv/slapd-dhcp201-149/db/../fribak.

Execute script
[root@dhcp201-149 export]# ./bakchk.sh /var/lib/dirsrv/slapd-dhcp201-149/bak/dhcp201-149-2014_08_19_18_19_05/userRoot/ /var/lib/dirsrv/slapd-dhcp201-149/db/userRoot/
Checking aci.db4 ... PASS
Checking ancestorid.db4 ... PASS
Checking cn.db4 ... PASS
Checking entryrdn.db4 ... PASS
Checking id2entry.db4 ... PASS
Checking nsuniqueid.db4 ... PASS
Checking numsubordinates.db4 ... PASS
Checking objectclass.db4 ... PASS
Checking parentid.db4 ... PASS
Checking uniquemember.db4 ... PASS

[root@dhcp201-149 tmp]# cat dbscan.bak.685
=cn=directory%20manager                 
	2 6 7 8 9 
[root@dhcp201-149 tmp]# cat dbscan.db.685
=cn=directory%20manager                 
	2 6 7 8 9

Hence marking as VERIFIED.

Comment 4 errata-xmlrpc 2014-10-14 07:55:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1385.html


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