version 1.56.2.34, 2006/07/28 22:11:19
|
version 1.56.2.35, 2006/07/31 18:27:42
|
Line 1
|
Line 1
|
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.56.2.33 2006/05/27 09:01:06 hyc Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.56.2.34 2006/07/28 22:11:19 quanah 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 1276 syncprov_checkpoint( Operation *op, Slap
|
Line 1276 syncprov_checkpoint( Operation *op, Slap
|
} |
} |
|
|
static void |
static void |
syncprov_add_slog( Operation *op, struct berval *csn ) |
syncprov_add_slog( Operation *op ) |
{ |
{ |
opcookie *opc = op->o_callback->sc_private; |
opcookie *opc = op->o_callback->sc_private; |
slap_overinst *on = opc->son; |
slap_overinst *on = opc->son; |
Line 1288 syncprov_add_slog( Operation *op, struct
|
Line 1288 syncprov_add_slog( Operation *op, struct
|
{ |
{ |
/* Allocate a record. UUIDs are not NUL-terminated. */ |
/* Allocate a record. UUIDs are not NUL-terminated. */ |
se = ch_malloc( sizeof( slog_entry ) + opc->suuid.bv_len + |
se = ch_malloc( sizeof( slog_entry ) + opc->suuid.bv_len + |
csn->bv_len + 1 ); |
op->o_csn.bv_len + 1 ); |
se->se_next = NULL; |
se->se_next = NULL; |
se->se_tag = op->o_tag; |
se->se_tag = op->o_tag; |
|
|
Line 1297 syncprov_add_slog( Operation *op, struct
|
Line 1297 syncprov_add_slog( Operation *op, struct
|
se->se_uuid.bv_len = opc->suuid.bv_len; |
se->se_uuid.bv_len = opc->suuid.bv_len; |
|
|
se->se_csn.bv_val = se->se_uuid.bv_val + opc->suuid.bv_len; |
se->se_csn.bv_val = se->se_uuid.bv_val + opc->suuid.bv_len; |
AC_MEMCPY( se->se_csn.bv_val, csn->bv_val, csn->bv_len ); |
AC_MEMCPY( se->se_csn.bv_val, op->o_csn.bv_val, op->o_csn.bv_len ); |
se->se_csn.bv_val[csn->bv_len] = '\0'; |
se->se_csn.bv_val[op->o_csn.bv_len] = '\0'; |
se->se_csn.bv_len = csn->bv_len; |
se->se_csn.bv_len = op->o_csn.bv_len; |
|
|
ldap_pvt_thread_mutex_lock( &sl->sl_mutex ); |
ldap_pvt_thread_mutex_lock( &sl->sl_mutex ); |
if ( sl->sl_head ) { |
if ( sl->sl_head ) { |
Line 1483 syncprov_op_response( Operation *op, Sla
|
Line 1483 syncprov_op_response( Operation *op, Sla
|
|
|
if ( rs->sr_err == LDAP_SUCCESS ) |
if ( rs->sr_err == LDAP_SUCCESS ) |
{ |
{ |
struct berval maxcsn = BER_BVNULL, curcsn = BER_BVNULL; |
struct berval maxcsn = BER_BVNULL; |
char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; |
char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE]; |
|
|
/* Update our context CSN */ |
/* Update our context CSN */ |
cbuf[0] = '\0'; |
cbuf[0] = '\0'; |
ldap_pvt_thread_mutex_lock( &si->si_csn_mutex ); |
ldap_pvt_thread_mutex_lock( &si->si_csn_mutex ); |
slap_get_commit_csn( op, &maxcsn, &curcsn ); |
slap_get_commit_csn( op, &maxcsn, NULL ); |
if ( !BER_BVISNULL( &maxcsn ) ) { |
if ( !BER_BVISNULL( &maxcsn ) ) { |
strcpy( cbuf, maxcsn.bv_val ); |
strcpy( cbuf, maxcsn.bv_val ); |
if ( ber_bvcmp( &maxcsn, &si->si_ctxcsn ) > 0 ) { |
if ( ber_bvcmp( &maxcsn, &si->si_ctxcsn ) > 0 ) { |
Line 1550 syncprov_op_response( Operation *op, Sla
|
Line 1550 syncprov_op_response( Operation *op, Sla
|
|
|
/* Add any log records */ |
/* Add any log records */ |
if ( si->si_logs && op->o_tag != LDAP_REQ_ADD ) { |
if ( si->si_logs && op->o_tag != LDAP_REQ_ADD ) { |
syncprov_add_slog( op, &curcsn ); |
syncprov_add_slog( op ); |
} |
} |
|
|
} |
} |