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

Re: (ITS#5597) syncrepl can fail to compare CSN from provider



rein@OpenLDAP.org wrote:
> Full_Name: Rein Tollevik
> Version: CVS head
> OS: linux, solaris
> URL:
> Submission from: (NULL) (84.215.36.97)
> Submitted by: rein
>
>
> If the syncrepl provider presents the same (or a lower) number of contextCSN
> values than the consumer has, but with other sid values, it can fail to update
> its values.
> This is mostly seen in a multiple masters (as opposed to a multi-master)
> configuration.
>
> The patch at the end should fix that.  Does it look OK Howard?

Yes, looks fine, go ahead and commit.
>
> Rein Tollevik
> Basefarm AS
>
> Index: syncrepl.c
> ===================================================================
> RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/syncrepl.c,v
> retrieving revision 1.405
> diff -u -u -r1.405 syncrepl.c
> --- syncrepl.c	4 Jul 2008 21:44:39 -0000	1.405
> +++ syncrepl.c	4 Jul 2008 21:48:13 -0000
> @@ -689,8 +689,8 @@
>   		return -1;
>   	}
>
> -	for (i=0; i<sc1->numcsns; i++) {
> -		for (j=0; j<sc2->numcsns; j++) {
> +	for (j=0; j<sc2->numcsns; j++) {
> +		for (i=0; i<sc1->numcsns; i++) {
>   			if ( sc1->sids[i] != sc2->sids[j] )
>   				continue;
>   			value_match(&match, slap_schema.si_ad_entryCSN,
> @@ -703,6 +703,11 @@
>   			}
>   			break;
>   		}
> +		if ( i == sc1->numcsns ) {
> +			/* sc2 has a sid sc1 lacks */
> +			*which = j;
> +			return -1;
> +		}
>   	}
>   	return match;
>   }
>
>
>


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/