mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 16:49:39 -05:00
Single consumer context per database
This commit is contained in:
parent
4c21a2712f
commit
f845c573b0
11 changed files with 26 additions and 46 deletions
|
|
@ -163,9 +163,9 @@ retry: /* transaction retry */
|
|||
matched = NULL;
|
||||
|
||||
} else {
|
||||
if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
|
||||
syncinfo_t *si;
|
||||
LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
|
||||
if ( op->o_bd->be_syncinfo ) {
|
||||
syncinfo_t *si = op->o_bd->be_syncinfo;
|
||||
{
|
||||
struct berval tmpbv;
|
||||
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
|
||||
ber_bvarray_add( &deref, &tmpbv );
|
||||
|
|
|
|||
|
|
@ -392,9 +392,9 @@ retry: /* transaction retry */
|
|||
e = NULL;
|
||||
|
||||
} else {
|
||||
if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
|
||||
syncinfo_t *si;
|
||||
LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
|
||||
if ( op->o_bd->be_syncinfo ) {
|
||||
syncinfo_t *si = op->o_bd->be_syncinfo;
|
||||
{
|
||||
struct berval tmpbv;
|
||||
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
|
||||
ber_bvarray_add( &deref, &tmpbv );
|
||||
|
|
|
|||
|
|
@ -182,9 +182,9 @@ retry: /* transaction retry */
|
|||
e = NULL;
|
||||
|
||||
} else {
|
||||
if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
|
||||
syncinfo_t *si;
|
||||
LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
|
||||
if ( op->o_bd->be_syncinfo ) {
|
||||
syncinfo_t *si = op->o_bd->be_syncinfo;
|
||||
{
|
||||
struct berval tmpbv;
|
||||
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
|
||||
ber_bvarray_add( &deref, &tmpbv );
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ ldbm_back_delete(
|
|||
cache_return_entry_r( &li->li_cache, matched );
|
||||
|
||||
} else {
|
||||
if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
|
||||
syncinfo_t *si;
|
||||
LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
|
||||
if ( op->o_bd->be_syncinfo ) {
|
||||
syncinfo_t *si = op->o_bd->be_syncinfo;
|
||||
{
|
||||
struct berval tmpbv;
|
||||
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
|
||||
ber_bvarray_add( &deref, &tmpbv );
|
||||
|
|
|
|||
|
|
@ -257,9 +257,9 @@ ldbm_back_modify(
|
|||
: NULL;
|
||||
cache_return_entry_r( &li->li_cache, matched );
|
||||
} else {
|
||||
if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
|
||||
syncinfo_t *si;
|
||||
LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
|
||||
if ( op->o_bd->be_syncinfo ) {
|
||||
syncinfo_t *si = op->o_bd->be_syncinfo;
|
||||
{
|
||||
struct berval tmpbv;
|
||||
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
|
||||
ber_bvarray_add( &deref, &tmpbv );
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@ ldbm_back_modrdn(
|
|||
: NULL;
|
||||
cache_return_entry_r( &li->li_cache, matched );
|
||||
} else {
|
||||
if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
|
||||
syncinfo_t *si;
|
||||
LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
|
||||
if ( op->o_bd->be_syncinfo ) {
|
||||
syncinfo_t *si = op->o_bd->be_syncinfo;
|
||||
{
|
||||
struct berval tmpbv;
|
||||
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
|
||||
ber_bvarray_add( &deref, &tmpbv );
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ int backend_startup(Backend *be)
|
|||
if ( rc ) return rc;
|
||||
|
||||
|
||||
if ( !LDAP_STAILQ_EMPTY( &backendDB[i].be_syncinfo )) {
|
||||
if ( backendDB[i].be_syncinfo ) {
|
||||
syncinfo_t *si;
|
||||
|
||||
if ( !( backendDB[i].be_search && backendDB[i].be_add &&
|
||||
|
|
@ -277,7 +277,8 @@ int backend_startup(Backend *be)
|
|||
continue;
|
||||
}
|
||||
|
||||
LDAP_STAILQ_FOREACH( si, &backendDB[i].be_syncinfo, si_next ) {
|
||||
{
|
||||
si = backendDB[i].be_syncinfo;
|
||||
si->si_be = &backendDB[i];
|
||||
init_syncrepl( si );
|
||||
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
|
||||
|
|
@ -371,7 +372,6 @@ int backend_destroy(void)
|
|||
{
|
||||
int i;
|
||||
BackendDB *bd;
|
||||
syncinfo_t *si_entry;
|
||||
struct slap_csn_entry *csne;
|
||||
|
||||
ldap_pvt_thread_pool_destroy( &syncrepl_pool, 1 );
|
||||
|
|
@ -379,10 +379,8 @@ int backend_destroy(void)
|
|||
/* destroy each backend database */
|
||||
for( i = 0, bd = backendDB; i < nBackendDB; i++, bd++ ) {
|
||||
|
||||
while ( !LDAP_STAILQ_EMPTY( &bd->be_syncinfo )) {
|
||||
si_entry = LDAP_STAILQ_FIRST( &bd->be_syncinfo );
|
||||
LDAP_STAILQ_REMOVE_HEAD( &bd->be_syncinfo, si_next );
|
||||
syncinfo_free( si_entry );
|
||||
if ( bd->be_syncinfo ) {
|
||||
syncinfo_free( bd->be_syncinfo );
|
||||
}
|
||||
|
||||
if ( bd->be_pending_csn_list ) {
|
||||
|
|
@ -500,8 +498,6 @@ backend_db_init(
|
|||
be->be_pcl_mutexp = &be->be_pcl_mutex;
|
||||
ldap_pvt_thread_mutex_init( be->be_pcl_mutexp );
|
||||
|
||||
LDAP_STAILQ_INIT( &be->be_syncinfo );
|
||||
|
||||
/* assign a default depth limit for alias deref */
|
||||
be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH;
|
||||
|
||||
|
|
|
|||
|
|
@ -1637,9 +1637,7 @@ add_syncrepl(
|
|||
)
|
||||
{
|
||||
syncinfo_t *si;
|
||||
syncinfo_t *si_entry;
|
||||
int rc = 0;
|
||||
int duplicated_replica_id = 0;
|
||||
|
||||
si = (syncinfo_t *) ch_calloc( 1, sizeof( syncinfo_t ) );
|
||||
|
||||
|
|
@ -1678,16 +1676,7 @@ add_syncrepl(
|
|||
|
||||
rc = parse_syncrepl_line( cargv, cargc, si );
|
||||
|
||||
LDAP_STAILQ_FOREACH( si_entry, &be->be_syncinfo, si_next ) {
|
||||
if ( si->si_rid == si_entry->si_rid ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"add_syncrepl: duplicated replica id\n",0, 0, 0 );
|
||||
duplicated_replica_id = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( rc < 0 || duplicated_replica_id ) {
|
||||
if ( rc < 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY, "failed to add syncinfo\n", 0, 0, 0 );
|
||||
syncinfo_free( si );
|
||||
return 1;
|
||||
|
|
@ -1699,7 +1688,7 @@ add_syncrepl(
|
|||
SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
|
||||
}
|
||||
si->si_be = be;
|
||||
LDAP_STAILQ_INSERT_TAIL( &be->be_syncinfo, si, si_next );
|
||||
be->be_syncinfo = si;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ frontend_init( void )
|
|||
/* FIXME: do we need this? */
|
||||
frontendDB->be_pcl_mutexp = &frontendDB->be_pcl_mutex;
|
||||
ldap_pvt_thread_mutex_init( frontendDB->be_pcl_mutexp );
|
||||
|
||||
LDAP_STAILQ_INIT( &frontendDB->be_syncinfo );
|
||||
#endif
|
||||
|
||||
/* suffix */
|
||||
|
|
|
|||
|
|
@ -1514,7 +1514,6 @@ typedef struct syncinfo_s {
|
|||
Avlnode *si_presentlist;
|
||||
LDAP *si_ld;
|
||||
LDAP_LIST_HEAD(np, nonpresent_entry) si_nonpresentlist;
|
||||
LDAP_STAILQ_ENTRY( syncinfo_s ) si_next;
|
||||
} syncinfo_t;
|
||||
|
||||
LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry );
|
||||
|
|
@ -1678,7 +1677,7 @@ struct slap_backend_db {
|
|||
struct be_pcl *be_pending_csn_list;
|
||||
ldap_pvt_thread_mutex_t be_pcl_mutex;
|
||||
ldap_pvt_thread_mutex_t *be_pcl_mutexp;
|
||||
LDAP_STAILQ_HEAD( be_si, syncinfo_s ) be_syncinfo; /* For syncrepl */
|
||||
syncinfo_t *be_syncinfo; /* For syncrepl */
|
||||
|
||||
char *be_realm;
|
||||
void *be_pb; /* Netscape plugin */
|
||||
|
|
|
|||
|
|
@ -998,8 +998,6 @@ do_syncrepl(
|
|||
|
||||
if ( !si->si_retrynum || si->si_retrynum[i] == -2 ) {
|
||||
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]--;
|
||||
|
|
|
|||
Loading…
Reference in a new issue