[python-ldap] syncrepl and FreeIPA

Petr Spacek pspacek at redhat.com
Fri Sep 26 14:04:41 CEST 2014


On 25.9.2014 20:33, Chris Mikkelson wrote:
> On Thu, Sep 25, 2014 at 06:37:50PM +0200, Michael Ströder wrote:
>> Petr Spacek wrote:
>>> The patch or some other alternative for end-of-refresh-phase-detection is
>>> required for further development in the FreeIPA project...
>>
>> I'm curious:
>> What's the use-case for syncrepl in FreeIPA?
>
> I'm also curious about this.
>
> FWIW, I've detected the end of refresh by watching for the first
> syncrepl_set_cookie() call. I do not know if this heuristic relies
> on OpenLDAP's implementation, but in order for this not to work, the
> server would have to make the rather odd choice to send a cookie
> along with an entry in the middle of the refresh phase.
>
> A separate method is a cleaner approach, though.
>
> It should suffice (and address the style nits) to replace
> the two current occurrences of:
>
> 	self.__refreshDone = sim.refreshDelete['refreshDone']
>
> with:
> 	if sim.refreshDelete['refreshDone']:
> 	    self.__refreshDone = True
> 	    self.syncrepl_refreshdone()
>
> Patch attached.

I agree that Chris's approach is better. I mis-interpreted RFC 4533 and 
thought that Sync Info Message could potentially contain *both* 
refreshDelete[refreshDone] = TRUE and refreshPresent[refreshDone] = TRUE.

This assumption is clearly wrong (see RFC 4533 section 2.5: "syncInfoValue ::= 
CHOICE" ...) so we should use Chris's patch. It is smaller and nicer :-)

I'm attaching fixed Chris's patch which is applicable on top of latest CVS 
checkout. It effectively revers my patch and replaces it with Chris's code.

I corrected two mistakes in the proposed patch:
- the original patch read value refreshDone value from sim.refreshPresnt even 
if there was only sim.refreshDelete present
- typo "refreshPresnt"

The API stays same.

Have a nice day!

-- 
Petr Spacek  @  Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Reworked-syncrepl_refreshdone-hook-as-proposed-by-Ch.patch
Type: text/x-patch
Size: 2334 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20140926/2e7a50b9/attachment.bin>


More information about the python-ldap mailing list