}
}
- ldap_pvt_thread_mutex_init( &syncrepl_rq.rq_mutex );
- LDAP_STAILQ_INIT( &syncrepl_rq.task_list );
- LDAP_STAILQ_INIT( &syncrepl_rq.run_list );
+ ldap_pvt_thread_mutex_init( &slapd_rq.rq_mutex );
+ LDAP_STAILQ_INIT( &slapd_rq.task_list );
+ LDAP_STAILQ_INIT( &slapd_rq.run_list );
/* open each backend database */
for( i = 0; i < nBackendDB; i++ ) {
LDAP_STAILQ_FOREACH( si, &backendDB[i].be_syncinfo, si_next ) {
si->si_be = &backendDB[i];
init_syncrepl( si );
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
- ldap_pvt_runqueue_insert( &syncrepl_rq,
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+ ldap_pvt_runqueue_insert( &slapd_rq,
si->si_interval, do_syncrepl, (void *) si );
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
}
}
}
time_t starttime;
ber_socket_t dtblsize;
slap_ssf_t local_ssf = LDAP_PVT_SASL_LOCAL_SSF;
+struct runqueue_s slapd_rq;
Listener **slap_listeners = NULL;
else
tvp = NULL;
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
- rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+ rtask = ldap_pvt_runqueue_next_sched( &slapd_rq, &cat );
while ( cat && cat->tv_sec && cat->tv_sec <= now ) {
- if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
+ if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
} else {
- ldap_pvt_runqueue_runtask( &syncrepl_rq, rtask );
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_runqueue_runtask( &slapd_rq, rtask );
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
ldap_pvt_thread_pool_submit( &connection_pool,
rtask->routine, (void *) rtask );
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
}
- rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
+ rtask = ldap_pvt_runqueue_next_sched( &slapd_rq, &cat );
}
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
if ( cat != NULL ) {
time_t diff = difftime( cat->tv_sec, now );
* wake it back up
*/
if ( cm->cc_paused ) {
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
if ( cm->cc_paused ) {
cm->cc_paused = 0;
- ldap_pvt_runqueue_resched( &syncrepl_rq, cm->cc_arg, 0 );
+ ldap_pvt_runqueue_resched( &slapd_rq, cm->cc_arg, 0 );
}
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
}
}
}
ldap_pvt_thread_mutex_unlock(&cm->remove_mutex);
}
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
- if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
- ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+ if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
+ ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
}
/* If there were no queries, defer processing for a while */
cm->cc_paused = pause;
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, pause );
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, pause );
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
return NULL;
}
/* There is no runqueue in TOOL mode */
if ( slapMode & SLAP_SERVER_MODE ) {
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
- ldap_pvt_runqueue_insert( &syncrepl_rq, cm->cc_period,
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+ ldap_pvt_runqueue_insert( &slapd_rq, cm->cc_period,
consistency_check, on );
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
/* Cached database must have the rootdn */
if ( BER_BVISNULL( &cm->db.be_rootndn )
LDAP_SLAPD_V (volatile sig_atomic_t) slapd_shutdown;
LDAP_SLAPD_V (int) slapd_register_slp;
LDAP_SLAPD_V (slap_ssf_t) local_ssf;
+LDAP_SLAPD_V (struct runqueue_s) slapd_rq;
/*
* dn.c
* syncrepl.c
*/
-LDAP_SLAPD_V (struct runqueue_s) syncrepl_rq;
-
LDAP_SLAPD_F (void) init_syncrepl LDAP_P((syncinfo_t *));
LDAP_SLAPD_F (void*) do_syncrepl LDAP_P((void *, void *));
LDAP_SLAPD_F (int) syncrepl_message_to_entry LDAP_P((
static AttributeDescription *sync_descs[4];
-struct runqueue_s syncrepl_rq;
-
void
init_syncrepl(syncinfo_t *si)
{
* 3) for Refresh and Success, reschedule to run
* 4) for Persist and Success, reschedule to defer
*/
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
- if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
- ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask );
+ if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
+ ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
}
if ( dostop ) {
defer = 0;
}
rtask->interval.tv_sec = si->si_interval;
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, defer );
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, defer );
if ( si->si_retrynum ) {
for ( i = 0; si->si_retrynum_init[i] != -2; i++ ) {
si->si_retrynum[i] = si->si_retrynum_init[i];
}
if ( !si->si_retrynum || si->si_retrynum[i] == -2 ) {
- ldap_pvt_runqueue_remove( &syncrepl_rq, rtask );
+ ldap_pvt_runqueue_remove( &slapd_rq, rtask );
LDAP_STAILQ_REMOVE( &be->be_syncinfo, si, syncinfo_s, si_next );
syncinfo_free( si );
} else if ( si->si_retrynum[i] >= -1 ) {
if ( si->si_retrynum[i] > 0 )
si->si_retrynum[i]--;
rtask->interval.tv_sec = si->si_retryinterval[i];
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
slap_wake_listener();
}
}
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
return NULL;
}