Bug 1369572

Summary: cleanallruv changelog cleaning incorrectly impacts all backends
Product: Red Hat Enterprise Linux 6 Reporter: Noriko Hosoi <nhosoi>
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact: Marc Muehlfeld <mmuehlfe>
Priority: unspecified    
Version: 6.7CC: mreynolds, nkinder, rmeggins, sramling
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.2.11.15-83.el6 Doc Type: Bug Fix
Doc Text:
The "cleanAllRUV" task no longer corrupts changelog back ends At the end of the "cleanAllRUV" task, Directory Server removes entries from the replication changelog that contain the cleaned replica ID. Previously, the task incorrectly ran all changelog back ends instead of only the one set in the task. As a consequence, if multiple back ends contained the same replica ID, the "cleanAllRUV" task corrupted them. This update fixes the problem and now the "cleanAllRUV" task works correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 10:22:39 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:

Description Noriko Hosoi 2016-08-23 19:42:28 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/48964

At the end of the cleanAllRUV task the changelog is purged of entries that contain the invalid rid, but it "cleans" all the backend changelogs.  It should only clean the specific backend changelog specified in the clean task.

Comment 3 Sankar Ramalingam 2016-11-22 07:32:27 UTC
1). 4 masters and 2 consumers replication setup.

2). Creating replica Id same for M1 and M3 with the same replica Id as M2 for suffix o=test.com
[root@auto-hv-02-guest09 MMR_WINSYNC]# ldapsearch -D "cn=directory manager" -w Secret123 -h localhost -p 1289 -x -o ldif-wrap=no -b  "cn=replica,cn=dc\3Dpasssync\2Cdc\3Dcom,cn=mapping tree,cn=config" |grep -i nsDS5ReplicaId:
nsDS5ReplicaId: 2212
[root@auto-hv-02-guest09 MMR_WINSYNC]# ldapsearch -D "cn=directory manager" -w Secret123 -h localhost -p 1189 -x -o ldif-wrap=no -b  "cn=replica,cn=o\3Dtest.com,cn=mapping tree,cn=config" |grep -i nsDS5ReplicaId:
nsDS5ReplicaId: 2212
[root@auto-hv-02-guest09 MMR_WINSYNC]# ldapsearch -D "cn=directory manager" -w Secret123 -h localhost -p 2189 -x -o ldif-wrap=no -b  "cn=replica,cn=o\3Dtest.com,cn=mapping tree,cn=config" |grep -i nsDS5ReplicaId:
nsDS5ReplicaId: 2212

3). Adding new entries to o=test.com to update the changelog
./AddEntry.sh Users 2189 "ou=people,o=test.com" newrrr 99 localhost
./AddEntry.sh Users 1189 "ou=people,o=test.com" newrrr 99 localhost

4). Adding new entries to the default replciation suffix to update the change log.
./AddEntry.sh Users 1289 "ou=people,dc=passsync,dc=com" updchlog01 9 localhost 
./AddEntry.sh Users 1189 "ou=people,dc=passsync,dc=com" updchlog00 9 localhost

5). Stop M2 and remove replication agreements from other masters.
[root@auto-hv-02-guest09 MMR_WINSYNC]# PORT=1189; SUFF="ou=people,dc=passsync,dc=com"; for PORT in `echo "1189 1289 1389 1489 2189 2289"`; do /usr/bin/ldapsearch -x -p $PORT -h localhost -D "cn=Directory Manager" -w Secret123 -b $SUFF |grep -i dn: | wc -l ; done 
12142
12142
[root@auto-hv-02-guest09 MMR_WINSYNC]# service dirsrv stop M2
Shutting down dirsrv: 
    M2...[  OK  ]
[root@auto-hv-02-guest09 MMR_WINSYNC]# ldapdelete -D "cn=directory manager" -w Secret123 -h localhost -p 1189 -x "cn=1189_to_1626_on_`hostname`,cn=replica,cn=dc\3Dpasssync\2Cdc\3Dcom,cn=mapping tree,cn=config"
[root@auto-hv-02-guest09 MMR_WINSYNC]# ldapdelete -D "cn=directory manager" -w Secret123 -h localhost -p 2189 -x "cn=2189_to_1626_on_`hostname`,cn=replica,cn=dc\3Dpasssync\2Cdc\3Dcom,cn=mapping tree,cn=config"
[root@auto-hv-02-guest09 MMR_WINSYNC]# ldapdelete -D "cn=directory manager" -w Secret123 -h localhost -p 2289 -x "cn=2289_to_1626_on_`hostname`,cn=replica,cn=dc\3Dpasssync\2Cdc\3Dcom,cn=mapping tree,cn=config"

6). Running cleanallruv task for M2.
[root@auto-hv-02-guest09 MMR_WINSYNC]# cat /export/clean_ruv.ldif 
dn: cn=M2clean,cn=cleanallruv,cn=tasks,cn=config
cn: M2clean
objectclass: extensibleObject
replica-base-dn: dc=passsync,dc=com
replica-id: 2212
[root@auto-hv-02-guest09 MMR_WINSYNC]# ldapmodify -x -p 1189 -h localhost -D "cn=Directory Manager" -w Secret123 -avf /export/clean_ruv.ldif 
ldap_initialize( ldap://localhost:1189 )
add cn:
	M2clean
add objectclass:
	extensibleObject
add replica-base-dn:
	dc=passsync,dc=com
add replica-id:
	2212
adding new entry "cn=M2clean,cn=cleanallruv,cn=tasks,cn=config"
modify complete

7). Checking error logs for masters

[22/Nov/2016:02:15:58 -0500] NSMMReplicationPlugin - CleanAllRUV Task (rid 2212): Successfully cleaned rid(2212). 
[root@auto-hv-02-guest09 MMR_WINSYNC]# grep -i "Successfully cleaned " /var/log/dirsrv/slapd-M1/errors 
[22/Nov/2016:02:15:58 -0500] NSMMReplicationPlugin - CleanAllRUV Task (rid 2212): Successfully cleaned rid(2212). 
[root@auto-hv-02-guest09 MMR_WINSYNC]# grep -i "Successfully cleaned " /var/log/dirsrv/slapd-M3/errors 
[22/Nov/2016:02:15:48 -0500] NSMMReplicationPlugin - CleanAllRUV Task (rid 2212): Successfully cleaned rid(2212). 
[root@auto-hv-02-guest09 MMR_WINSYNC]# grep -i "Successfully cleaned " /var/log/dirsrv/slapd-M4/errors 
[22/Nov/2016:02:15:48 -0500] NSMMReplicationPlugin - CleanAllRUV Task (rid 2212): Successfully cleaned rid(2212). 

8). Stop M1 and M3 to check if cl-dump shows entries added o=test.com
service dirsrv stop M1 ; service dirsrv stop M3

9). Run cl-dump to check if entries are present from step 3.
[root@auto-hv-02-guest09 MMR_WINSYNC]# /usr/bin/cl-dump -D "cn=directory manager" -w Secret123 -p 1189 -h localhost -r "o=test.com" | grep -i "uid=newrrr72,ou=people,o=test.com"
dn: uid=newrrr72,ou=People,o=test.com
entrydn: uid=newrrr72,ou=people,o=test.com
[root@auto-hv-02-guest09 MMR_WINSYNC]# /usr/bin/cl-dump -D "cn=directory manager" -w Secret123 -p 1189 -h localhost -r "o=test.com" | grep -i "uid=newrrr9,ou=people,o=test.com"
dn: uid=newrrr9,ou=People,o=test.com
entrydn: uid=newrrr9,ou=people,o=test.com
[root@auto-hv-02-guest09 MMR_WINSYNC]# /usr/bin/cl-dump -D "cn=directory manager" -w Secret123 -p 2189 -h localhost -r "o=test.com" | grep -i "uid=newrrr9,ou=people,o=test.com"
dn: uid=newrrr9,ou=People,o=test.com
entrydn: uid=newrrr9,ou=people,o=test.com

Cleanallruv doesn't impact other entries or changelog. Hence, marking the bug as Verified.

[root@auto-hv-02-guest09 MMR_WINSYNC]# rpm -qa |grep -i 389-ds
389-ds-base-1.2.11.15-85.el6.x86_64
389-ds-base-libs-1.2.11.15-85.el6.x86_64

Comment 8 errata-xmlrpc 2017-03-21 10:22:39 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.

https://rhn.redhat.com/errata/RHBA-2017-0667.html