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

Re: (ITS#5434) syncprov in a glue'ed environment must search through the glue overlay



On Wed, 19 Mar 2008, Howard Chu wrote:

> rein@basefarm.no wrote:
>>
>> When the syncprov overlay is stacked on top of other overlays (notably the
>> glue
>> overlay) it must search through the next overlay, not the original backend
>> DB.
>> Otherwise it will not find any entries from the subordinate databases and
>> consumers will remove those entries when they enters the refresh phase of
>> the
>> syncrepl protocol.
>>
>> The attached patch fixes this problem.
>
> Thanks, fixed in HEAD

It looks as if my fix to this bug was utterly wrong :-(  It probably only
works when syncprov is stacked on top of the glue overlay. not with other
overlays.

First, searching through the next overlay looses the overlay semantics
(i.e to return SLAP_CB_CONTINUE etc.)  Even worse, a seg. fault will
occur if the bi_op_search() method is not implement by the next overlay.
I don't know whether that is actually allowed or not, but it is not done
in at least the auditlog overlay.

The correct fix should (I hope...) be to use the original overinst
structure as the bd_info, as the patch at the end (which is relative to
the current cvs head) implements.  Since o_sync_mode appear to always
have been cleared before be_search() is called it should be ignored by
syncprov_op_search().

Sorry for the inconvenience!

Rein

Index: OpenLDAP/servers/slapd/overlays/syncprov.c
diff -u OpenLDAP/servers/slapd/overlays/syncprov.c:1.1.1.12 OpenLDAP/servers/slapd/overlays/syncprov.c:1.9
--- OpenLDAP/servers/slapd/overlays/syncprov.c:1.1.1.12	Sat Mar 22 16:48:20 2008
+++ OpenLDAP/servers/slapd/overlays/syncprov.c	Sun Mar 23 14:06:03 2008
@@ -696,10 +696,7 @@
  		break;
  	}

-	if ( on->on_next )
-		fop.o_bd->bd_info = (BackendInfo *)on->on_next;
-	else
-		fop.o_bd->bd_info = on->on_info->oi_orig;
+	fop.o_bd->bd_info = (BackendInfo *)on->on_info;
  	fop.o_bd->be_search( &fop, &frs );
  	fop.o_bd->bd_info = (BackendInfo *)on;

@@ -1531,10 +1528,7 @@
  		fop.ors_filter = ⁡

  		cb.sc_response = playlog_cb;
-		if ( on->on_next )
-			fop.o_bd->bd_info = (BackendInfo *)on->on_next;
-		else
-			fop.o_bd->bd_info = on->on_info->oi_orig;
+		fop.o_bd->bd_info = (BackendInfo *)on->on_info;

  		for ( i=ndel; i<num; i++ ) {
  			if ( uuids[i].bv_len == 0 ) continue;