Forráskód Böngészése

Trac Ticket #18 - Data inconsitency during replication

https://fedorahosted.org/389/ticket/18

Bug description: If promote a hub server to a new master and
assign the same replica ID as the original master server had,
some new adds/modifies to the new server may dropped and not
be replicated to the consumers.
Fix description: If a hub is promoted to a master, consumer's
RUV is updated.  It only updated the master's URL, but not the
CSN and min CSN.  This patch resets the CSNs if the URL needs
to be updated.
Noriko Hosoi 14 éve
szülő
commit
daaae1c5ee
1 módosított fájl, 12 hozzáadás és 7 törlés
  1. 12 7
      ldap/servers/plugins/replication/repl5_ruv.c

+ 12 - 7
ldap/servers/plugins/replication/repl5_ruv.c

@@ -479,21 +479,26 @@ int
 ruv_replace_replica_purl (RUV *ruv, ReplicaId rid, const char *replica_purl)
 {
     RUVElement* replica;
-	int rc = RUV_NOTFOUND;
-	
+    int rc = RUV_NOTFOUND;
+
     PR_ASSERT (ruv && replica_purl);
 
     slapi_rwlock_wrlock (ruv->lock);
     replica = ruvGetReplica (ruv, rid);
     if (replica != NULL)
     {
-		slapi_ch_free((void **)&(replica->replica_purl));
-		replica->replica_purl = slapi_ch_strdup(replica_purl);
+        if (strcmp(replica->replica_purl, replica_purl)) { /* purl updated */
+            /* Replace replica_purl in RUV since supplier has been updated. */
+            slapi_ch_free((void **)&(replica->replica_purl));
+            replica->replica_purl = slapi_ch_strdup(replica_purl);
+            /* Also, reset csn and min_csn. */
+            replica->csn = replica->min_csn = NULL;
+        }
         rc = RUV_SUCCESS;
-	}
+    }
 
-	slapi_rwlock_unlock (ruv->lock);
-	return rc;
+    slapi_rwlock_unlock (ruv->lock);
+    return rc;
 }
 
 int