version 1.56.2.37, 2006/08/15 19:50:10
|
version 1.56.2.38, 2006/10/31 18:32:36
|
Line 1
|
Line 1
|
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.158 2006/08/15 19:41:14 hyc Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.56.2.37 2006/08/15 19:50:10 hyc Exp $ */ |
/* syncprov.c - syncrepl provider */ |
/* syncprov.c - syncrepl provider */ |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
* |
* |
Line 1243 syncprov_op_cleanup( Operation *op, Slap
|
Line 1243 syncprov_op_cleanup( Operation *op, Slap
|
} |
} |
|
|
static void |
static void |
syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on ) |
syncprov_checkpoint( Operation *op, SlapReply *rs, slap_overinst *on, |
|
struct berval *csn ) |
{ |
{ |
syncprov_info_t *si = on->on_bi.bi_private; |
|
Modifications mod; |
Modifications mod; |
Operation opm; |
Operation opm; |
SlapReply rsm = { 0 }; |
SlapReply rsm = { 0 }; |
Line 1253 syncprov_checkpoint( Operation *op, Slap
|
Line 1253 syncprov_checkpoint( Operation *op, Slap
|
slap_callback cb = {0}; |
slap_callback cb = {0}; |
|
|
/* If ctxcsn is empty, delete it */ |
/* If ctxcsn is empty, delete it */ |
if ( BER_BVISEMPTY( &si->si_ctxcsn )) { |
if ( BER_BVISEMPTY( csn )) { |
mod.sml_values = NULL; |
mod.sml_values = NULL; |
} else { |
} else { |
mod.sml_values = bv; |
mod.sml_values = bv; |
bv[1].bv_val = NULL; |
bv[1].bv_val = NULL; |
bv[0] = si->si_ctxcsn; |
bv[0] = *csn; |
} |
} |
mod.sml_nvalues = NULL; |
mod.sml_nvalues = NULL; |
mod.sml_desc = slap_schema.si_ad_contextCSN; |
mod.sml_desc = slap_schema.si_ad_contextCSN; |
Line 1493 syncprov_op_response( Operation *op, Sla
|
Line 1493 syncprov_op_response( Operation *op, Sla
|
{ |
{ |
struct berval maxcsn = BER_BVNULL; |
struct berval maxcsn = BER_BVNULL; |
char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; |
char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; |
|
int do_check = 0; |
|
|
/* Update our context CSN */ |
/* Update our context CSN */ |
cbuf[0] = '\0'; |
cbuf[0] = '\0'; |
Line 1515 syncprov_op_response( Operation *op, Sla
|
Line 1516 syncprov_op_response( Operation *op, Sla
|
|
|
si->si_numops++; |
si->si_numops++; |
if ( si->si_chkops || si->si_chktime ) { |
if ( si->si_chkops || si->si_chktime ) { |
int do_check=0; |
|
if ( si->si_chkops && si->si_numops >= si->si_chkops ) { |
if ( si->si_chkops && si->si_numops >= si->si_chkops ) { |
do_check = 1; |
do_check = 1; |
si->si_numops = 0; |
si->si_numops = 0; |
Line 1525 syncprov_op_response( Operation *op, Sla
|
Line 1525 syncprov_op_response( Operation *op, Sla
|
do_check = 1; |
do_check = 1; |
si->si_chklast = op->o_time; |
si->si_chklast = op->o_time; |
} |
} |
if ( do_check ) { |
|
syncprov_checkpoint( op, rs, on ); |
|
} |
|
} |
} |
ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex ); |
ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex ); |
|
|
opc->sctxcsn.bv_len = maxcsn.bv_len; |
opc->sctxcsn.bv_len = maxcsn.bv_len; |
opc->sctxcsn.bv_val = cbuf; |
opc->sctxcsn.bv_val = cbuf; |
|
|
|
if ( do_check ) { |
|
syncprov_checkpoint( op, rs, on, &opc->sctxcsn ); |
|
} |
|
|
/* Handle any persistent searches */ |
/* Handle any persistent searches */ |
if ( si->si_ops ) { |
if ( si->si_ops ) { |
switch(op->o_tag) { |
switch(op->o_tag) { |
Line 2458 syncprov_db_close(
|
Line 2459 syncprov_db_close(
|
op->o_bd = be; |
op->o_bd = be; |
op->o_dn = be->be_rootdn; |
op->o_dn = be->be_rootdn; |
op->o_ndn = be->be_rootndn; |
op->o_ndn = be->be_rootndn; |
syncprov_checkpoint( op, &rs, on ); |
syncprov_checkpoint( op, &rs, on, &si->si_ctxcsn ); |
ldap_pvt_thread_pool_context_reset( thrctx ); |
ldap_pvt_thread_pool_context_reset( thrctx ); |
} |
} |
|
|