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

Re: How the backend knows it's being searched by syncprov?



Pierangelo Masarati wrote:

Howard Chu wrote:

Pierangelo Masarati wrote:

hyc@OpenLDAP.org wrote:

Update of /repo/OpenLDAP/pkg/ldap/servers/slapd/overlays

Modified Files:
syncprov.c 1.24 -> 1.25


Howard,

to use syncprov on top of back-sql, I need the backend to know it's being searched for sync replication purposes when filtering for CSN. To this end, I added a function slap_find_control_id() that returns the cid for a given control oid; then, to determine if a search is performed for syncrepl purposes, I'd use

       slap_find_control_id( LDAP_CONTROL_SYNC, &sync_cid );

to grab the control's cid at initialization and, when requested to filter for CSN, I'd test (op->o_controls[sync_cid]).
sync_cid could be a back-sql wide static variable, initialized to -1 and grabbed, for instance, at bi_open(); or it could
even be global scoped, in case other backends need to be syncrepl-aware.


Do you think this is correct?

Ciao, Ando.



Yes, thanks. I meant to add a function like this already but forgot.


If you have one, go ahead. Otherwise I'll commit mine

OK, done.


If we really need global knowledge of this control


back-sql has because it needs to generate appropriate entryCSN values if searched for syncrepl purposes. At the moment I don't see the need for any other piece of code.

The entryCSN values are pretty much equivalent to modifyTimestamp. But how can you generate these values on the fly?


--
 -- Howard Chu
 Chief Architect, Symas Corp.       Director, Highland Sun
 http://www.symas.com               http://highlandsun.com/hyc
 Symas: Premier OpenSource Development and Support