Patch for ITS#3133

This commit is contained in:
Jong Hyuk Choi 2004-05-31 02:01:59 +00:00
parent d75c35e9de
commit b85ba35ba7
4 changed files with 29 additions and 9 deletions

View File

@ -302,7 +302,9 @@ int backend_startup(Backend *be)
if(be != NULL) {
/* startup a specific backend database */
LDAP_TAILQ_INIT( &be->be_pending_csn_list );
be->be_pending_csn_list = (struct be_pcl *)
ch_calloc( 1, sizeof( struct be_pcl ));
LDAP_TAILQ_INIT( be->be_pending_csn_list );
#ifdef NEW_LOGGING
LDAP_LOG( BACKEND, DETAIL1, "backend_startup: starting \"%s\"\n",
@ -381,7 +383,9 @@ int backend_startup(Backend *be)
/* append global access controls */
acl_append( &backendDB[i].be_acl, global_acl );
LDAP_TAILQ_INIT( &backendDB[i].be_pending_csn_list );
backendDB[i].be_pending_csn_list = (struct be_pcl *)
ch_calloc( 1, sizeof( struct be_pcl ));
LDAP_TAILQ_INIT( backendDB[i].be_pending_csn_list );
if ( backendDB[i].be_suffix == NULL ) {
#ifdef NEW_LOGGING

View File

@ -138,6 +138,7 @@ glue_back_db_open (
glueOpened = 1;
gi->bd.be_acl = be->be_acl;
gi->bd.be_pending_csn_list = be->be_pending_csn_list;
if (gi->bd.bd_info->bi_db_open)
rc = gi->bd.bd_info->bi_db_open(&gi->bd);
@ -284,6 +285,19 @@ glue_back_search ( Operation *op, SlapReply *rs )
#ifdef LDAP_SCOPE_SUBORDINATE
case LDAP_SCOPE_SUBORDINATE: /* FIXME */
#endif
if ( op->o_sync_mode & SLAP_SYNC_REFRESH ) {
op->o_bd = glue_back_select (b0, op->o_req_ndn.bv_val);
if (op->o_bd && op->o_bd->be_search) {
rs->sr_err = op->o_bd->be_search( op, rs );
} else {
send_ldap_error(op, rs, LDAP_UNWILLING_TO_PERFORM,
"No search target found");
}
return rs->sr_err;
}
op->o_callback = &cb;
rs->sr_err = gs.err = LDAP_UNWILLING_TO_PERFORM;
scope0 = op->ors_scope;

View File

@ -41,14 +41,14 @@ slap_get_commit_csn( Operation *op, struct berval *csn )
ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex );
LDAP_TAILQ_FOREACH( csne, &op->o_bd->be_pending_csn_list, ce_csn_link ) {
LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) {
if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) {
csne->ce_state = SLAP_CSN_COMMIT;
break;
}
}
LDAP_TAILQ_FOREACH( csne, &op->o_bd->be_pending_csn_list, ce_csn_link ) {
LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) {
if ( csne->ce_state == SLAP_CSN_COMMIT ) committed_csne = csne;
if ( csne->ce_state == SLAP_CSN_PENDING ) break;
}
@ -64,7 +64,7 @@ slap_rewind_commit_csn( Operation *op )
ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex );
LDAP_TAILQ_FOREACH( csne, &op->o_bd->be_pending_csn_list, ce_csn_link ) {
LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) {
if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) {
csne->ce_state = SLAP_CSN_PENDING;
break;
@ -84,9 +84,9 @@ slap_graduate_commit_csn( Operation *op )
ldap_pvt_thread_mutex_lock( &op->o_bd->be_pcl_mutex );
LDAP_TAILQ_FOREACH( csne, &op->o_bd->be_pending_csn_list, ce_csn_link ) {
LDAP_TAILQ_FOREACH( csne, op->o_bd->be_pending_csn_list, ce_csn_link ) {
if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) {
LDAP_TAILQ_REMOVE( &op->o_bd->be_pending_csn_list,
LDAP_TAILQ_REMOVE( op->o_bd->be_pending_csn_list,
csne, ce_csn_link );
ch_free( csne->ce_csn->bv_val );
ch_free( csne->ce_csn );
@ -166,7 +166,7 @@ slap_get_csn(
pending->ce_connid = op->o_connid;
pending->ce_opid = op->o_opid;
pending->ce_state = SLAP_CSN_PENDING;
LDAP_TAILQ_INSERT_TAIL( &op->o_bd->be_pending_csn_list,
LDAP_TAILQ_INSERT_TAIL( op->o_bd->be_pending_csn_list,
pending, ce_csn_link );
ldap_pvt_thread_mutex_unlock( &op->o_bd->be_pcl_mutex );
}

View File

@ -1415,6 +1415,8 @@ typedef struct syncinfo_s {
LDAP_STAILQ_ENTRY( syncinfo_s ) si_next;
} syncinfo_t;
LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry );
struct slap_backend_db {
BackendInfo *bd_info; /* pointer to shared backend info */
@ -1567,7 +1569,7 @@ struct slap_backend_db {
char *be_replogfile; /* replication log file (in master) */
struct berval be_update_ndn; /* allowed to make changes (in replicas) */
BerVarray be_update_refs; /* where to refer modifying clients to */
LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry ) be_pending_csn_list;
struct be_pcl *be_pending_csn_list;
ldap_pvt_thread_mutex_t be_pcl_mutex;
struct berval be_context_csn;
ldap_pvt_thread_mutex_t be_context_csn_mutex;