From: Jong Hyuk Choi Date: Mon, 31 May 2004 02:01:59 +0000 (+0000) Subject: Patch for ITS#3133 X-Git-Tag: OPENDLAP_REL_ENG_2_2_MP~314 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b85ba35ba704fd9c3f05c17c0c810d0a3dcc05ba;p=openldap Patch for ITS#3133 --- diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index b99ecdc1e2..903176c62a 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -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 diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index cd8a63d354..04d36ea608 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -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; diff --git a/servers/slapd/ctxcsn.c b/servers/slapd/ctxcsn.c index ab1061978e..4672273293 100644 --- a/servers/slapd/ctxcsn.c +++ b/servers/slapd/ctxcsn.c @@ -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 ); } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index a20909d27a..c7e76756ac 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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;