Issue 3228 - Duplicated replication with two databases
Summary: Duplicated replication with two databases
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-09 15:26 UTC by andreas@canonical.com
Modified: 2014-08-01 21:05 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description andreas@canonical.com 2004-07-09 15:26:08 UTC
Full_Name: Andreas Hasenack
Version: 2.1.30
OS: Linux 2.6.x
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (200.140.247.99)


With the following setup (two databases), changes are sent twice to the slave
server. Obviously, the secont time the change is already there and a replication
error occurs.

MASTER
database        bdb
subordinate
suffix          "ou=Branch1,dc=my-domain,dc=com"
rootdn          "cn=Manager,dc=my-domain,dc=com"
directory       /var/lib/ldap-branch

index objectClass eq

access to attr=userPassword
        by anonymous auth
        by self write
        by * none
access to attr=shadowLastChange
        by self write
        by * read
access to *
        by * read

replica host=build-cl9.distro.conectiva tls=no
        suffix="ou=Branch1,dc=my-domain,dc=com"
        bindmethod=simple
        binddn="uid=replicator,dc=my-domain,dc=com"
        credentials="replicator"
replogfile /var/lib/replog/master-replog

database        bdb
suffix          "dc=my-domain,dc=com"
rootdn          "cn=Manager,dc=my-domain,dc=com"
rootpw          changethis
directory       /var/lib/openldap-data

index   objectClass     eq

access to attr=userPassword
        by anonymous auth
        by self write
        by * none
access to attr=shadowLastChange
        by self write
        by * read
access to *
        by * read

replica host=build-cl9.distro.conectiva tls=no
        suffix="dc=my-domain,dc=com"
        bindmethod=simple
        binddn="uid=replicator,dc=my-domain,dc=com"
        credentials="replicator"
replogfile /var/lib/replog/master-replog


I added a "description" attribute under the "uid=replicator" entry. It got sent
twice to the slave server.

/var/lib/slurpd/replica/slurpd.replog:
replica: build-cl9.distro.conectiva
time: 1089386416
dn: uid=replicator,dc=my-domain,dc=com
changetype: modify
add: description
description:: dXN1w6FyaW8gZGUgcmVwbGljYcOnw6Nv
-
replace: entryCSN
entryCSN: 2004070915:20:16Z#0x0001#0#0000
-
replace: modifiersName
modifiersName: cn=Manager,dc=my-domain,dc=com
-
replace: modifyTimestamp
modifyTimestamp: 20040709152016Z
-

LDAP log on the slave:
Jul  9 12:17:47 buildmaster slapd[24432]: conn=5 fd=17 ACCEPT from
IP=10.0.2.177:40993 (IP=0.0.0.0:389)
Jul  9 12:17:47 buildmaster slapd[24432]: conn=6 fd=20 ACCEPT from
IP=10.0.2.177:40994 (IP=0.0.0.0:389)
Jul  9 12:17:47 buildmaster slapd[24447]: conn=5 op=0 BIND
dn="uid=replicator,dc=my-domain,dc=com" method=128
Jul  9 12:17:47 buildmaster slapd[24447]: conn=5 op=0 BIND
dn="uid=replicator,dc=my-domain,dc=com" mech=simple ssf=0
Jul  9 12:17:47 buildmaster slapd[24447]: conn=5 op=0 RESULT tag=97 err=0 text=
Jul  9 12:17:47 buildmaster slapd[24441]: conn=6 op=0 BIND
dn="uid=replicator,dc=my-domain,dc=com" method=128
Jul  9 12:17:47 buildmaster slapd[24441]: conn=6 op=0 BIND
dn="uid=replicator,dc=my-domain,dc=com" mech=simple ssf=0
Jul  9 12:17:47 buildmaster slapd[24441]: conn=6 op=0 RESULT tag=97 err=0 text=
Jul  9 12:17:47 buildmaster slapd[24447]: conn=5 op=1 MOD
dn="uid=replicator,dc=my-domain,dc=com"
Jul  9 12:17:47 buildmaster slapd[24447]: conn=5 op=1 MOD attr=description
entryCSN modifiersName modifyTimestamp
Jul  9 12:17:47 buildmaster slapd[24441]: conn=6 op=1 MOD
dn="uid=replicator,dc=my-domain,dc=com"
Jul  9 12:17:47 buildmaster slapd[24441]: conn=6 op=1 MOD attr=description
entryCSN modifiersName modifyTimestamp
Jul  9 12:17:47 buildmaster slapd[24447]: conn=5 op=1 RESULT tag=103 err=0
text=
Jul  9 12:17:47 buildmaster slapd[24441]: conn=6 op=1 RESULT tag=103 err=20
text=modify/add: description: value #0 already exists

Comment 1 andreas@canonical.com 2004-07-09 15:39:05 UTC
Doing it manually. I started slapd but didn't start slurpd.

After adding the description attribute, the replog file contains:

replica: build-cl9.distro.conectiva
time: 1089387331
dn: uid=replicator,dc=my-domain,dc=com
changetype: modify
add: description
description: this is a description
-
replace: entryCSN
entryCSN: 2004070915:35:31Z#0x0001#0#0000
-
replace: modifiersName
modifiersName: cn=Manager,dc=my-domain,dc=com
-
replace: modifyTimestamp
modifyTimestamp: 20040709153531Z
-


Seems right.
Now I run slurpd on it:

# slurpd -d 256 -f /etc/openldap/slapd.conf -r master-replog -o -t /var/lib/slurpd/
@(#) $OpenLDAP: slurpd 2.1.30 (Jun 19 2004 04:53:21) $
        root@mapi8.distro.conectiva:/usr/src/rpm/BUILD/openldap-2.1.30/servers/slurpd

Processing in one-shot mode:
1 total replication records in file,
1 replication records to process.
request 1 done
request 1 done
request 2 done
request 2 done
Error: ldap_modify_s failed modifying "modify/add: description: value #0 already exists": uid=replicator,dc=my-domain,dc=com
Error: ldap operation failed, data written to "/var/lib/slurpd//replica/build-cl9.distro.conectiva:0.rej"
slurpd: terminated.

Two requests? Well, it duplicated the change somehow. Worked the first time, but obviously failed the second time.

Comment 2 andreas@canonical.com 2004-07-09 18:39:02 UTC
Just for fun, I replaced one of the replica lines with the IP
address of the slave host instead of its name. That is, I made
the directive different from the other one, but still pointing to
the same host.

Voilà, it started working.

So, instead of:
(...)
replica uri=ldap://build-cl9.distro.conectiva:389
(...)
replica uri=ldap://build-cl9.distro.conectiva:389
(...)


I have:
(...)
replica uri=ldap://10.0.17.107:389
(...)
replica uri=ldap://build-cl9.distro.conectiva:389
(...)

Then it works (yes, I also switched to using "uri" instead of "host"
midtesting, but that alone didn't help).
10.0.17.107 is the IP address of build-cl9.distro.conectiva. Just having
it "different" in the two replica directives seemed to be the trick.


Comment 3 Howard Chu 2004-07-14 00:53:06 UTC
changed notes
Comment 4 Kurt Zeilenga 2004-08-28 05:10:56 UTC
changed notes
changed state Open to Closed
Comment 5 Howard Chu 2009-02-17 05:25:25 UTC
moved from Incoming to Archive.Incoming
Comment 6 OpenLDAP project 2014-08-01 21:05:50 UTC
dup of #2137