From: Kurt Zeilenga Date: Sat, 7 Nov 1998 02:25:32 +0000 (+0000) Subject: Make flush_writes the default. Change option to 'dbcachenowsync'. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1170 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3f1b97481c01943ba63e17162b8b82af9dcf6dcc;p=openldap Make flush_writes the default. Change option to 'dbcachenowsync'. Change backend struct option to li_dbcachewsync. --- diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index 06c5063151..223dc9bccc 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -266,6 +266,10 @@ by the LDBM backend database instance. The default is 1000 entries. Specify the size in bytes of the in-memory cache associated with each open index file. If not supported by the underlying database method, this option is ignored without comment. The default is 100000 bytes. +.B dbcachenowsync +Specify that database writes should not be immediately synchronized +with in memory changes. Enabling this option may improving performance +at the expense of data security. .TP .B directory Specify the directory where the LDBM files containing the database and diff --git a/servers/slapd/back-ldbm/back-ldbm.h b/servers/slapd/back-ldbm/back-ldbm.h index dda1ff8452..960d2e1d4e 100644 --- a/servers/slapd/back-ldbm/back-ldbm.h +++ b/servers/slapd/back-ldbm/back-ldbm.h @@ -110,7 +110,7 @@ struct ldbminfo { struct cache li_cache; Avlnode *li_attrs; int li_dbcachesize; - int li_flush_wrt; + int li_dbcachewsync; struct dbcache li_dbcache[MAXDBCACHE]; pthread_mutex_t li_dbcache_mutex; pthread_cond_t li_dbcache_cv; diff --git a/servers/slapd/back-ldbm/config.c b/servers/slapd/back-ldbm/config.c index 0e087dc0b1..a47d7a14a1 100644 --- a/servers/slapd/back-ldbm/config.c +++ b/servers/slapd/back-ldbm/config.c @@ -80,9 +80,9 @@ ldbm_back_config( } li->li_dbcachesize = atoi( argv[1] ); - /* flush on writes */ - } else if ( strcasecmp( argv[0], "flushwrites" ) == 0 ) { - li->li_flush_wrt = 1; + /* no write sync */ + } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) { + li->li_dbcachewsync = 0; /* anything else */ } else { diff --git a/servers/slapd/back-ldbm/dn2id.c b/servers/slapd/back-ldbm/dn2id.c index ff56ba616b..4a7da28731 100644 --- a/servers/slapd/back-ldbm/dn2id.c +++ b/servers/slapd/back-ldbm/dn2id.c @@ -50,7 +50,7 @@ dn2id_add( data.dsize = sizeof(ID); flags = LDBM_INSERT; - if ( li->li_flush_wrt ) flags |= LDBM_SYNC; + if ( li->li_dbcachewsync ) flags |= LDBM_SYNC; rc = ldbm_cache_store( db, key, data, flags ); diff --git a/servers/slapd/back-ldbm/id2entry.c b/servers/slapd/back-ldbm/id2entry.c index c458ca503f..edc8f4c7b2 100644 --- a/servers/slapd/back-ldbm/id2entry.c +++ b/servers/slapd/back-ldbm/id2entry.c @@ -48,7 +48,7 @@ id2entry_add( Backend *be, Entry *e ) /* store it */ flags = LDBM_REPLACE; - if ( li->li_flush_wrt ) flags |= LDBM_SYNC; + if ( li->li_dbcachewsync ) flags |= LDBM_SYNC; rc = ldbm_cache_store( db, key, data, flags ); pthread_mutex_unlock( &entry2str_mutex ); diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index 2f96f8f3c5..a19786603a 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -195,7 +195,7 @@ idl_store( #endif flags = LDBM_REPLACE; - if( li->li_flush_wrt ) flags |= LDBM_SYNC; + if( li->li_dbcachewsync ) flags = LDBM_SYNC; rc = ldbm_cache_store( db, key, data, flags ); /* Debug( LDAP_DEBUG_TRACE, "<= idl_store %d\n", rc, 0, 0 ); */ diff --git a/servers/slapd/back-ldbm/init.c b/servers/slapd/back-ldbm/init.c index 65fda43785..9193f7213c 100644 --- a/servers/slapd/back-ldbm/init.c +++ b/servers/slapd/back-ldbm/init.c @@ -34,6 +34,9 @@ ldbm_back_init( /* default database cache size */ li->li_dbcachesize = DEFAULT_DBCACHE_SIZE; + /* default cache mode is sync on write */ + li->li_dbcachewsync = 1; + /* default file creation mode */ li->li_mode = DEFAULT_MODE;