ldap/servers/plugins/replication/repl5_ruv.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
New commits:
commit daaae1c5ee00c43506543bb1ac469545bb2c6004
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jan 19 11:19:53 2012 -0800
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.
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c
b/ldap/servers/plugins/replication/repl5_ruv.c
index e5ddb39..e0b10ae 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.c
+++ b/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