From: Randy Kunkee Date: Thu, 28 Jun 2001 18:02:46 +0000 (+0000) Subject: Remove global_backendsyncfreq code (code has been pushed down into back-ldbm). X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1273 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a9097044ea91333c5b01939882cd452400fd7231;p=openldap Remove global_backendsyncfreq code (code has been pushed down into back-ldbm). --- diff --git a/servers/slapd/back-ldap/init.c b/servers/slapd/back-ldap/init.c index aed385cfd7..4b4c6975d6 100644 --- a/servers/slapd/back-ldap/init.c +++ b/servers/slapd/back-ldap/init.c @@ -74,7 +74,6 @@ ldap_back_initialize( bi->bi_db_open = 0; bi->bi_db_close = 0; bi->bi_db_destroy = ldap_back_db_destroy; - bi->bi_db_sync = 0; bi->bi_op_bind = ldap_back_bind; bi->bi_op_unbind = 0; diff --git a/servers/slapd/back-ldbm/config.c b/servers/slapd/back-ldbm/config.c index f574839fd5..1c882ee4fd 100644 --- a/servers/slapd/back-ldbm/config.c +++ b/servers/slapd/back-ldbm/config.c @@ -122,7 +122,6 @@ ldbm_back_db_config( } li->li_dbsyncfreq = i; - li->li_dbwritesync = 0; if ( argc > 2 ) { i = atoi( argv[2] ); diff --git a/servers/slapd/back-ldbm/dbcache.c b/servers/slapd/back-ldbm/dbcache.c index 20abce3e81..ef86d83a33 100644 --- a/servers/slapd/back-ldbm/dbcache.c +++ b/servers/slapd/back-ldbm/dbcache.c @@ -46,7 +46,7 @@ ldbm_cache_open( flags |= LDBM_NOLOCKING; } - if( li->li_dbwritesync && global_backendsyncfreq == 0) { + if( li->li_dbwritesync && li->li_dbsyncfreq == 0) { flags |= LDBM_SYNC; } else { flags |= LDBM_NOSYNC; diff --git a/servers/slapd/back-ldbm/init.c b/servers/slapd/back-ldbm/init.c index 4b9e257a46..8054d1a6d2 100644 --- a/servers/slapd/back-ldbm/init.c +++ b/servers/slapd/back-ldbm/init.c @@ -52,7 +52,6 @@ ldbm_back_initialize( bi->bi_db_open = ldbm_back_db_open; bi->bi_db_close = ldbm_back_db_close; bi->bi_db_destroy = ldbm_back_db_destroy; - bi->bi_db_sync = ldbm_cache_sync; bi->bi_op_bind = ldbm_back_bind; bi->bi_op_unbind = ldbm_back_unbind; diff --git a/servers/slapd/back-meta/init.c b/servers/slapd/back-meta/init.c index 032fe9c875..4e30347442 100644 --- a/servers/slapd/back-meta/init.c +++ b/servers/slapd/back-meta/init.c @@ -105,7 +105,6 @@ meta_back_initialize( bi->bi_db_open = 0; bi->bi_db_close = 0; bi->bi_db_destroy = meta_back_db_destroy; - bi->bi_db_sync = 0; bi->bi_op_bind = meta_back_bind; bi->bi_op_unbind = 0; diff --git a/servers/slapd/back-passwd/init.c b/servers/slapd/back-passwd/init.c index cda250b1fd..5190bff4c1 100644 --- a/servers/slapd/back-passwd/init.c +++ b/servers/slapd/back-passwd/init.c @@ -40,7 +40,6 @@ passwd_back_initialize( bi->bi_db_open = 0; bi->bi_db_close = 0; bi->bi_db_destroy = 0; - bi->bi_db_sync = 0; bi->bi_op_bind = 0; bi->bi_op_unbind = 0; diff --git a/servers/slapd/back-shell/init.c b/servers/slapd/back-shell/init.c index 1a83449d14..ddebb961ef 100644 --- a/servers/slapd/back-shell/init.c +++ b/servers/slapd/back-shell/init.c @@ -44,7 +44,6 @@ shell_back_initialize( bi->bi_db_open = 0; bi->bi_db_close = 0; bi->bi_db_destroy = shell_back_db_destroy; - bi->bi_db_sync = 0; bi->bi_op_bind = shell_back_bind; bi->bi_op_unbind = shell_back_unbind; diff --git a/servers/slapd/back-sql/init.c b/servers/slapd/back-sql/init.c index f25c502dd8..dca5ee5fb0 100644 --- a/servers/slapd/back-sql/init.c +++ b/servers/slapd/back-sql/init.c @@ -49,7 +49,6 @@ int sql_back_initialize( bi->bi_db_open = backsql_db_open; bi->bi_db_close = backsql_db_close; bi->bi_db_destroy = backsql_db_destroy; - bi->bi_db_sync = 0; #ifdef BACKSQL_ALL_DONE bi->bi_op_abandon = backsql_abandon; diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 750add8e12..c2edb36275 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -333,45 +333,6 @@ int backend_num( Backend *be ) return -1; } - -int backend_sync( Backend *be ) -{ - int i; - int rc = 0; - - if( be != NULL ) { - /* sync a specific backend database */ - - if ( be->bd_info->bi_nDB == 0 ) { - /* no database of this type, we never opened it */ - return 0; - } - - if ( be->bd_info->bi_db_sync ) { - be->bd_info->bi_db_sync( be ); - } - - return 0; - } - - /* sync each backend database */ - for( i = 0; i < nBackendDB; i++ ) { - if ( backendDB[i].bd_info->bi_db_sync ) { - rc = backendDB[i].bd_info->bi_db_sync( - &backendDB[i] ); - } - - if(rc != 0) { - Debug( LDAP_DEBUG_ANY, - "backend_sync: bi_sync %s failed!\n", - backendDB[i].be_type, 0, 0 ); - } - } - - return 0; -} - - int backend_shutdown( Backend *be ) { int i; diff --git a/servers/slapd/config.c b/servers/slapd/config.c index b5790d7f68..88b5db95a3 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -34,7 +34,6 @@ slap_ssf_set_t global_ssf_set; char *replogfile; int global_lastmod = ON; int global_idletimeout = 0; -int global_backendsyncfreq = 0; char *global_host = NULL; char *global_realm = NULL; char *ldap_srvtab = ""; @@ -1741,33 +1740,6 @@ read_config( const char *fname ) global_idletimeout = i; - /* set backend sync frequency */ - } else if ( strcasecmp( cargv[0], "backendsyncfreq" ) == 0 ) { -#ifndef NO_THREADS - int i; - if ( cargc < 2 ) { - Debug( LDAP_DEBUG_ANY, - "%s: line %d: missing frquency value in \"backendsyncfreq \" line\n", - fname, lineno, 0 ); - return 1; - } - - i = atoi( cargv[1] ); - - if( i < 0 ) { - Debug( LDAP_DEBUG_ANY, - "%s: line %d: frquency value (%d) invalid \"backendsyncfreq \" line\n", - fname, lineno, i ); - return 1; - } - - global_backendsyncfreq = i; -#else - Debug( LDAP_DEBUG_ANY, - "\"dbsyncfreq\" not supported in non-threaded environment\n"); - return 1; -#endif - /* include another config file */ } else if ( strcasecmp( cargv[0], "include" ) == 0 ) { if ( cargc < 2 ) { diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index ce3d1ae875..07bb58560e 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -1628,38 +1628,6 @@ slapd_daemon_task( } -static void * -sync_daemon( - void *ptr -) -{ - sleep( 1 ); - - Debug( LDAP_DEBUG_ANY, "synchronizer starting\n", 0, 0, 0 ); - - while (!slapd_shutdown) { - - sleep( global_backendsyncfreq ); - - /* - How do we wait for slapd to be idle? - Maybe this would work ? - while (ldap_pvt_thread_pool_backload(&connection_pool) != 0) - sleep(1); - */ - - if (!slapd_shutdown) { - Debug( LDAP_DEBUG_TRACE, "synchronizing\n", 0, 0, 0 ); - backend_sync( NULL ); - } - } - - Debug( LDAP_DEBUG_ANY, "synchronizer stopping\n", 0, 0, 0 ); - - return NULL; -} - - int slapd_daemon( void ) { int rc; @@ -1670,7 +1638,6 @@ int slapd_daemon( void ) #if defined( SLAPD_LISTENER_THREAD ) { ldap_pvt_thread_t listener_tid; - ldap_pvt_thread_t sync_tid; /* listener as a separate THREAD */ rc = ldap_pvt_thread_create( &listener_tid, @@ -1686,27 +1653,9 @@ int slapd_daemon( void ) #endif return rc; } - - /* sync thread */ - if ( global_backendsyncfreq > 0 ) - { - rc = ldap_pvt_thread_create( &sync_tid, - 0, sync_daemon, NULL ); - if ( rc != 0 ) - { - Debug( LDAP_DEBUG_ANY, - "sync ldap_pvt_thread_create failed (%d)\n", rc, 0, 0 ); - } - } - /* wait for the listener thread to complete */ ldap_pvt_thread_join( listener_tid, (void *) NULL ); - - if ( global_backendsyncfreq > 0 ) - { - ldap_pvt_thread_join( sync_tid, (void *) NULL ); - } } #else /* experimental code */ diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index f3a7c50238..d8e5e9b7a4 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -823,7 +823,6 @@ LDAP_SLAPD_F (int) g_argc; LDAP_SLAPD_F (slap_access_t) global_default_access; LDAP_SLAPD_F (int) global_lastmod; LDAP_SLAPD_F (int) global_idletimeout; -LDAP_SLAPD_F (int) global_backendsyncfreq; LDAP_SLAPD_F (int) global_schemacheck; LDAP_SLAPD_F (char) *global_host; LDAP_SLAPD_F (char) *global_realm; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index cd9c560fca..cc1fd71257 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -990,7 +990,6 @@ struct slap_backend_info { int (*bi_db_open) LDAP_P((Backend *bd)); int (*bi_db_close) LDAP_P((Backend *bd)); int (*bi_db_destroy) LDAP_P((Backend *db)); - int (*bi_db_sync) LDAP_P((Backend *db)); /* LDAP Operations Handling Routines */ int (*bi_op_bind) LDAP_P(( BackendDB *bd,