[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: MULTIMASTER



Hi,

digging the archives, I've come across the followup posting to ITS #170.
I updated the patch to work against -HEAD. For us, it made multimaster
replication work (including 'make test').
I thought I'd let you know since I guess a lot of people would like to
use OpenLDAP this way.

regards,
Markus


--- add.c.orig  Mon Jan  8 13:20:24 2001
+++ add.c       Mon Jan  8 13:20:10 2001
@@ -187,13 +187,10 @@
         */
        if ( be->be_add ) {
                /* do the update here */
-#ifdef SLAPD_MULTIMASTER
-               if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
-                       global_lastmod == ON)) && (be->be_update_ndn == NULL ||
-                       strcmp( be->be_update_ndn, op->o_ndn )) )
-#else
-               if ( be->be_update_ndn == NULL ||
-                       strcmp( be->be_update_ndn, op->o_ndn ) == 0 )
+               int repl_user = (be->be_update_ndn != NULL &&
+                       strcmp( be->be_update_ndn, op->o_ndn ) == 0);
+#ifndef SLAPD_MULTIMASTER
+               if ( be->be_update_ndn == NULL || repl_user )
 #endif
                {
                        int update = be->be_update_ndn != NULL;
@@ -205,11 +202,9 @@
                                goto done;
                        }
 
-#ifndef SLAPD_MULTIMASTER
                        if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
-                               global_lastmod == ON)) && !update )
-#endif
-                       {
+                               global_lastmod == ON)) && !repl_user )
+                        {
                                Modifications **modstail;
                                for( modstail = &mods;
                                        *modstail != NULL;
@@ -235,8 +230,7 @@
 
                        if ( (*be->be_add)( be, conn, op, e ) == 0 ) {
 #ifdef SLAPD_MULTIMASTER
-                               if (be->be_update_ndn == NULL ||
-                                       strcmp( be->be_update_ndn, op->o_ndn ))
+                               if ( !repl_user )
 #endif
                                {
                                        replog( be, op, e->e_dn, e );
--- modify.c.orig       Mon Jan  8 13:20:20 2001
+++ modify.c    Mon Jan  8 13:20:13 2001
@@ -204,12 +204,13 @@
         */
        if ( be->be_modify ) {
                /* do the update here */
+               int repl_user = (be->be_update_ndn != NULL &&
+                       strcmp( be->be_update_ndn, op->o_ndn ) == 0);
 #ifndef SLAPD_MULTIMASTER
-               /* we don't have to check for replicator dn
-                * because we accept each modify request
+               /* Multimaster slapd does not have to check for replicator dn
+                * because it accepts each modify request
                 */
-               if ( be->be_update_ndn == NULL ||
-                       strcmp( be->be_update_ndn, op->o_ndn ) == 0 )
+               if ( be->be_update_ndn == NULL || repl_user )
 #endif
                {
                        int update = be->be_update_ndn != NULL;
@@ -223,7 +224,7 @@
                        }
 
                        if ( (be->be_lastmod == ON || (be->be_lastmod == UNDEFINED &&
-                               global_lastmod == ON)) && !update )
+                               global_lastmod == ON)) && !repl_user )
                        {
                                Modifications **modstail;
                                for( modstail = &mods;
@@ -244,8 +245,7 @@
 
                        if ( (*be->be_modify)( be, conn, op, dn, ndn, mods ) == 0 
 #ifdef SLAPD_MULTIMASTER
-                               && ( be->be_update_ndn == NULL ||
-                                       strcmp( be->be_update_ndn, op->o_ndn ) != 0 )
+                               && !repl_user
 #endif
                        ) {
                                /* but we log only the ones not from a replicator user */
begin:vcard 
n:Storm;Markus
tel;fax:++49 +5241 80-67867
tel;work:++49 +5241 80-7867
x-mozilla-html:FALSE
org:mediaWays GmbH;NMW-T
adr:;;Postfach 185;Guetersloh;;33311;Germany
version:2.1
email;internet:Markus.Storm@mediaWays.net
x-mozilla-cpt:ils.mediaways.net;23744
fn:Markus Storm
end:vcard