]> git.sur5r.net Git - openldap/commitdiff
Single consumer context per database
authorHoward Chu <hyc@openldap.org>
Thu, 13 Jan 2005 21:15:50 +0000 (21:15 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 13 Jan 2005 21:15:50 +0000 (21:15 +0000)
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-ldbm/delete.c
servers/slapd/back-ldbm/modify.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/backend.c
servers/slapd/config.c
servers/slapd/frontend.c
servers/slapd/slap.h
servers/slapd/syncrepl.c

index 584fce898a876cb05b4e9903ffd077a3865e4083..8937180724a4c0bced890e71f660a30f504dcb6c 100644 (file)
@@ -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 );
index 109b41a6b3c69e7a73b420a213a9dd2824b95d18..4ad218ac1412be9ff69f8f161d1124184258737f 100644 (file)
@@ -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 );
index a08e7f8d16de7928764144b9223a9b62808d0a2c..b7ebd0bbff0fd81012ce39ab6b2bcef5db29cac8 100644 (file)
@@ -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 );
index 01ae6c72755f5256b7a5000f60c5f96aaebc48ae..88e54935752e2f6686e62b82ceac4781ee8b11e0 100644 (file)
@@ -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 );
index 21e4bdb74ccaffede7771496a5b47d7618f02b35..725298b78dc08ce737250adc32a5aab2bc6eeecc 100644 (file)
@@ -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 );
index d2cdf89816ff11be0f0fc6c48c237cffa44b4815..02039d4c9f1cd966111fd4f21db11af1a94141df 100644 (file)
@@ -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 );
index 91dc769818d86f3b87241e01f3a391a6859b17fa..13dd9613427d9639de855698e91531f65da63da2 100644 (file)
@@ -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; 
 
index 6a91564813dd3bd913aa9454d715e18633873bb2..72e8ef8c40859417f9e40b9a5c6a745e7cd840fd 100644 (file)
@@ -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;
        }
 }
index 3ab670dcae0ce69c9d4e3b598580bfd4d2158ca8..e1fca24d32d4eb01ffc1aea3dca32948316b20ce 100644 (file)
@@ -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 */
index 380ee9a53ef1e0e2b8a519151e26cff79f3c30b4..92dc8f2ef9d704c53cf88542221251991494176f 100644 (file)
@@ -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 */
index 50b1dc49f3853f92b62eda76b687a39203f48685..271399f654757613441aef379c5d4ab4a12c4cce 100644 (file)
@@ -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]--;