Bug 1044154 - multi master replication allows schema violation
Summary: multi master replication allows schema violation
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: rc
: ---
Assignee: Rich Megginson
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-17 21:31 UTC by Nathan Kinder
Modified: 2015-03-05 09:31 UTC (History)
3 users (show)

Fixed In Version: 389-ds-base-1.3.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 09:31:45 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0416 normal SHIPPED_LIVE Important: 389-ds-base security, bug fix, and enhancement update 2015-03-05 14:26:33 UTC

Description Nathan Kinder 2013-12-17 21:31:14 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/601

If an attribute is required by the schema any attempt to delete all values will fail without replication or on a single master.
But if the attribute has two values it is possible to simultaneously delete one value on one master and the other value on the other master - the individual operation is allowed as one value remains. After the two masters have replayed their changes to each other bot values have disappeared.

Comment 2 Viktor Ashirov 2014-12-10 23:31:28 UTC
$ rpm -qa  | grep 389
389-ds-base-1.3.3.1-9.el7.x86_64
389-ds-base-debuginfo-1.3.3.1-9.el7.x86_64
389-ds-base-libs-1.3.3.1-9.el7.x86_64

I can reproduce the problem. 
I set up MMR (M1 - 1189, M2 - 1289)

[1] Add test entry
$ ldapmodify -D "cn=Directory Manager" -w Secret123  -H ldap://localhost:1189 -a << EOF
dn: cn=user,ou=People,dc=example,dc=com
objectClass: inetUser
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: user
sn: user-M1
sn: user-M2
EOF
adding new entry "cn=user,ou=People,dc=example,dc=com"

[2] Check that it was synchronized 
$ ldapsearch -h rhel7ds.brq.redhat.com -p 1189 -D "cn=Directory Manager" -w "Secret123" -b "dc=example,dc=com"  "(cn=user)" sn -LLL
dn: cn=user,ou=People,dc=example,dc=com
sn: user-M1
sn: user-M2

$ ldapsearch -h rhel7ds.brq.redhat.com -p 1289 -D "cn=Directory Manager" -w "Secret123" -b "dc=example,dc=com"  "(cn=user)" sn -LLL
dn: cn=user,ou=People,dc=example,dc=com
sn: user-M1
sn: user-M2

[3] Stop M2
$ sudo systemctl stop dirsrv@M2

[4] Delete sn on M1
$ ldapmodify -D "cn=Directory Manager" -w Secret123  -H ldap://localhost:1189 << EOF
dn: cn=user,ou=People,dc=example,dc=com
changetype: modify
delete: sn
sn: user-M1
EOF
modifying entry "cn=user,ou=People,dc=example,dc=com"


$ ldapsearch -h rhel7ds.brq.redhat.com -p 1189 -D "cn=Directory Manager" -w "Secret123" -b "dc=example,dc=com"  "(cn=user)" sn -LLL
dn: cn=user,ou=People,dc=example,dc=com
cn: user
sn: user-M2

[5] Stop M1 and start M2
$ sudo systemctl stop dirsrv@M1
$ sudo systemctl start dirsrv@M2

[6] Delete sn on M2
$ ldapmodify -D "cn=Directory Manager" -w Secret123  -H ldap://localhost:1289 << EOF
dn: cn=user,ou=People,dc=example,dc=com
changetype: modify
delete: sn
sn: user-M2
EOF
modifying entry "cn=user,ou=People,dc=example,dc=com"

$ ldapsearch -h rhel7ds.brq.redhat.com -p 1289 -D "cn=Directory Manager" -w "Secret123" -b "dc=example,dc=com"  "(cn=user)" sn -LLL
dn: cn=user,ou=People,dc=example,dc=com
sn: user-M1

[7] Restart both M1 and M2
$ sudo systemctl restart dirsrv.target

[8] sn attribute was removed on both M1 and M2, though it violates the schema
$ ldapsearch -h rhel7ds.brq.redhat.com -p 1189 -D "cn=Directory Manager" -w "Secret123" -b "dc=example,dc=com"  "(cn=user)"  -LLL
dn: cn=user,ou=People,dc=example,dc=com
objectClass: inetUser
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: user

$ ldapsearch -h rhel7ds.brq.redhat.com -p 1289 -D "cn=Directory Manager" -w "Secret123" -b "dc=example,dc=com"  "(cn=user)"  -LLL
dn: cn=user,ou=People,dc=example,dc=com
objectClass: inetUser
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: user

In the errors log: 
[11/Dec/2014:00:07:42 +0100] - Entry "cn=user,ou=People,dc=example,dc=com" missing attribute "sn" required by object class "person"

Comment 3 Ludwig 2014-12-11 16:37:43 UTC
The situation cannot be prevented. The fix consists of detecting this situation and log an error and add a replication conflict attribute: nsds5ReplConflict

So the fix works as expected

Comment 4 Viktor Ashirov 2014-12-11 16:56:13 UTC
Sorry, it wasn't obvious from the description :(

$ ldapsearch -D "cn=Directory Manager" -w Secret123 -h localhost -p 1189 -b "dc=example,dc=com" "nsds5ReplConflict=*" \* nsds5ReplConflict -LLL
dn: cn=user,ou=People,dc=example,dc=com
objectClass: inetUser
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: user
nsds5ReplConflict: Schema violation


nsds5ReplConflict attribute was added on both masters. Marking as VERIFIED.

Comment 6 errata-xmlrpc 2015-03-05 09:31:45 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/RHSA-2015-0416.html


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