assert( be != NULL );
- be->be_pending_csn_list = (struct be_pcl *)
- ch_calloc( 1, sizeof( struct be_pcl ) );
-
- LDAP_TAILQ_INIT( be->be_pending_csn_list );
+ LDAP_TAILQ_INIT( &be->be_pcsn_st.be_pcsn_list );
Debug( LDAP_DEBUG_TRACE,
"backend_startup_one: starting \"%s\"\n",
void
backend_stopdown_one( BackendDB *bd )
{
- if ( bd->be_pending_csn_list ) {
- struct slap_csn_entry *csne;
- csne = LDAP_TAILQ_FIRST( bd->be_pending_csn_list );
- while ( csne ) {
- struct slap_csn_entry *tmp_csne = csne;
+ struct slap_csn_entry *csne;
+ csne = LDAP_TAILQ_FIRST( &bd->be_pcsn_st.be_pcsn_list );
+ while ( csne ) {
+ struct slap_csn_entry *tmp_csne = csne;
- LDAP_TAILQ_REMOVE( bd->be_pending_csn_list, csne, ce_csn_link );
- ch_free( csne->ce_csn.bv_val );
- csne = LDAP_TAILQ_NEXT( csne, ce_csn_link );
- ch_free( tmp_csne );
- }
- ch_free( bd->be_pending_csn_list );
+ LDAP_TAILQ_REMOVE( &bd->be_pcsn_st.be_pcsn_list, csne, ce_csn_link );
+ ch_free( csne->ce_csn.bv_val );
+ csne = LDAP_TAILQ_NEXT( csne, ce_csn_link );
+ ch_free( tmp_csne );
}
if ( bd->bd_info->bi_db_destroy ) {
ber_bvarray_free( bd->be_update_refs );
}
- ldap_pvt_thread_mutex_destroy( &bd->be_pcl_mutex );
+ ldap_pvt_thread_mutex_destroy( &bd->be_pcsn_st.be_pcsn_mutex );
if ( dynamic ) {
free( bd );
be->be_requires = frontendDB->be_requires;
be->be_ssf_set = frontendDB->be_ssf_set;
- ldap_pvt_thread_mutex_init( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_init( &be->be_pcsn_st.be_pcsn_mutex );
+ be->be_pcsn_p = &be->be_pcsn_st;
/* assign a default depth limit for alias deref */
be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH;
/* If we created and linked this be, remove it and free it */
if ( !b0 ) {
LDAP_STAILQ_REMOVE(&backendDB, be, BackendDB, be_next);
- ldap_pvt_thread_mutex_destroy( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_destroy( &be->be_pcsn_st.be_pcsn_mutex );
ch_free( be );
be = NULL;
nbackends--;
&gi->gi_n[gi->gi_nodes].gn_pdn );
gi->gi_nodes++;
on->on_bi.bi_private = gi;
+ ga->ga_be->be_pcsn_p = be->be_pcsn_p;
ga->ga_be->be_flags |= SLAP_DBFLAG_GLUE_LINKED;
break;
}
sid = slap_parse_csn_sid( &op->o_csn );
}
- ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_lock( &be->be_pcsn_p->be_pcsn_mutex );
- LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) {
+ LDAP_TAILQ_FOREACH( csne, &be->be_pcsn_p->be_pcsn_list, ce_csn_link ) {
if ( csne->ce_op == op ) {
csne->ce_state = SLAP_CSN_COMMIT;
if ( foundit ) *foundit = 1;
}
}
- LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) {
+ LDAP_TAILQ_FOREACH( csne, &be->be_pcsn_p->be_pcsn_list, ce_csn_link ) {
if ( sid != -1 && sid == csne->ce_sid ) {
if ( csne->ce_state == SLAP_CSN_COMMIT ) committed_csne = csne;
if ( csne->ce_state == SLAP_CSN_PENDING ) break;
maxcsn->bv_val[0] = 0;
}
}
- ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_unlock( &be->be_pcsn_p->be_pcsn_mutex );
}
void
struct slap_csn_entry *csne;
BackendDB *be = op->o_bd->bd_self;
- ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_lock( &be->be_pcsn_p->be_pcsn_mutex );
- LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) {
+ LDAP_TAILQ_FOREACH( csne, &be->be_pcsn_p->be_pcsn_list, ce_csn_link ) {
if ( csne->ce_op == op ) {
csne->ce_state = SLAP_CSN_PENDING;
break;
}
}
- ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_unlock( &be->be_pcsn_p->be_pcsn_mutex );
}
void
if ( op->o_bd == NULL ) return;
be = op->o_bd->bd_self;
- ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_lock( &be->be_pcsn_p->be_pcsn_mutex );
- LDAP_TAILQ_FOREACH( csne, be->be_pending_csn_list, ce_csn_link ) {
+ LDAP_TAILQ_FOREACH( csne, &be->be_pcsn_p->be_pcsn_list, ce_csn_link ) {
if ( csne->ce_op == op ) {
- LDAP_TAILQ_REMOVE( be->be_pending_csn_list,
+ LDAP_TAILQ_REMOVE( &be->be_pcsn_p->be_pcsn_list,
csne, ce_csn_link );
Debug( LDAP_DEBUG_SYNC, "slap_graduate_commit_csn: removing %p %s\n",
csne, csne->ce_csn.bv_val );
}
}
- ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_unlock( &be->be_pcsn_p->be_pcsn_mutex );
return;
}
pending->ce_op = op;
pending->ce_state = SLAP_CSN_PENDING;
- ldap_pvt_thread_mutex_lock( &be->be_pcl_mutex );
- LDAP_TAILQ_INSERT_TAIL( be->be_pending_csn_list,
+ ldap_pvt_thread_mutex_lock( &be->be_pcsn_p->be_pcsn_mutex );
+ LDAP_TAILQ_INSERT_TAIL( &be->be_pcsn_p->be_pcsn_list,
pending, ce_csn_link );
- ldap_pvt_thread_mutex_unlock( &be->be_pcl_mutex );
+ ldap_pvt_thread_mutex_unlock( &be->be_pcsn_p->be_pcsn_mutex );
}
int
frontendDB->be_def_limit.lms_s_pr_hide = 0; /* don't hide number of entries left */
frontendDB->be_def_limit.lms_s_pr_total = 0; /* number of total entries returned by pagedResults equal to hard limit */
- ldap_pvt_thread_mutex_init( &frontendDB->be_pcl_mutex );
+ ldap_pvt_thread_mutex_init( &frontendDB->be_pcsn_st.be_pcsn_mutex );
/* suffix */
frontendDB->be_suffix = ch_calloc( 2, sizeof( struct berval ) );
SLAP_DBFLAGS(&cm->db) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
cm->db.be_private = NULL;
cm->db.bd_self = &cm->db;
- cm->db.be_pending_csn_list = NULL;
cm->qm = qm;
cm->numattrsets = 0;
cm->num_entries_limit = 5;
backend_stopdown_one( &ov->db );
}
- ldap_pvt_thread_mutex_destroy( &ov->db.be_pcl_mutex );
+ ldap_pvt_thread_mutex_destroy( &ov->db.be_pcsn_st.be_pcsn_mutex );
ch_free(ov);
on->on_bi.bi_private = NULL;
}
LDAP_STAILQ_HEAD( slap_sync_cookie_s, sync_cookie );
-LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry );
+/* Defs for pending_csn_list */
+LDAP_TAILQ_HEAD( be_pclh, slap_csn_entry );
+
+typedef struct be_pcsn {
+ struct be_pclh be_pcsn_list;
+ ldap_pvt_thread_mutex_t be_pcsn_mutex;
+} be_pcsn;
#ifndef SLAP_MAX_CIDS
#define SLAP_MAX_CIDS 32 /* Maximum number of supported controls */
/* Consumer Information */
struct berval be_update_ndn; /* allowed to make changes (in replicas) */
BerVarray be_update_refs; /* where to refer modifying clients to */
- struct be_pcl *be_pending_csn_list;
- ldap_pvt_thread_mutex_t be_pcl_mutex;
+ be_pcsn be_pcsn_st; /* be_pending_csn_list now inside this */
+ be_pcsn *be_pcsn_p;
struct syncinfo_s *be_syncinfo; /* For syncrepl */
void *be_pb; /* Netscape plugin */