From a640ac21971fef404c690594c83a7f54c334fe90 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Jun 01 2012 18:09:13 +0000 Subject: Ticket #369 - restore of replica ldif file on second master after deleting two records shows only 1 deletion Bug Description: If you take a "db2ldif -r" on a consumer and later restore it "ldif2db" any changes made on that consumer after the backup(db2ldif), will not be replayed back to the consumer after it has been restored(ldif2db). Fix Description: When we check if we can skip updates from the change log, check if the consumer csn is "newer" than its current max csn. If it is, then it needs to be replayed back to itself. https://fedorahosted.org/389/ticket/369 Reviewed by: Nathan & Rich (Thanks!) --- diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c index 327cb6f..5816837 100644 --- a/ldap/servers/plugins/replication/cl5_clcache.c +++ b/ldap/servers/plugins/replication/cl5_clcache.c @@ -664,13 +664,24 @@ clcache_skip_change ( CLC_Buffer *buf ) rid = csn_get_replicaid ( buf->buf_current_csn ); /* - * Skip CSN that is originated from the consumer. + * Skip CSN that is originated from the consumer, + * unless the CSN is newer than the maxcsn. * If RID==65535, the CSN is originated from a * legacy consumer. In this case the supplier * and the consumer may have the same RID. */ - if (rid == buf->buf_consumer_rid && rid != MAX_REPLICA_ID) + if (rid == buf->buf_consumer_rid && rid != MAX_REPLICA_ID){ + CSN *cons_maxcsn = NULL; + + ruv_get_max_csn(buf->buf_consumer_ruv, &cons_maxcsn); + if ( csn_compare ( buf->buf_current_csn, cons_maxcsn) > 0 ) { + /* + * The consumer must have been "restored" and needs this newer update. + */ + skip = 0; + } break; + } /* Skip helper entry (ENTRY_COUNT, PURGE_RUV and so on) */ if ( cl5HelperEntry ( NULL, buf->buf_current_csn ) == PR_TRUE ) {