Skip to content
Snippets Groups Projects
Commit 3f1b9748 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Make flush_writes the default. Change option to 'dbcachenowsync'.

Change backend struct option to li_dbcachewsync.
parent f67adafb
No related branches found
No related tags found
No related merge requests found
...@@ -266,6 +266,10 @@ by the LDBM backend database instance. The default is 1000 entries. ...@@ -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 Specify the size in bytes of the in-memory cache associated
with each open index file. If not supported by the underlying database with each open index file. If not supported by the underlying database
method, this option is ignored without comment. The default is 100000 bytes. 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 .TP
.B directory <directory> .B directory <directory>
Specify the directory where the LDBM files containing the database and Specify the directory where the LDBM files containing the database and
......
...@@ -110,7 +110,7 @@ struct ldbminfo { ...@@ -110,7 +110,7 @@ struct ldbminfo {
struct cache li_cache; struct cache li_cache;
Avlnode *li_attrs; Avlnode *li_attrs;
int li_dbcachesize; int li_dbcachesize;
int li_flush_wrt; int li_dbcachewsync;
struct dbcache li_dbcache[MAXDBCACHE]; struct dbcache li_dbcache[MAXDBCACHE];
pthread_mutex_t li_dbcache_mutex; pthread_mutex_t li_dbcache_mutex;
pthread_cond_t li_dbcache_cv; pthread_cond_t li_dbcache_cv;
......
...@@ -80,9 +80,9 @@ ldbm_back_config( ...@@ -80,9 +80,9 @@ ldbm_back_config(
} }
li->li_dbcachesize = atoi( argv[1] ); li->li_dbcachesize = atoi( argv[1] );
/* flush on writes */ /* no write sync */
} else if ( strcasecmp( argv[0], "flushwrites" ) == 0 ) { } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) {
li->li_flush_wrt = 1; li->li_dbcachewsync = 0;
/* anything else */ /* anything else */
} else { } else {
......
...@@ -50,7 +50,7 @@ dn2id_add( ...@@ -50,7 +50,7 @@ dn2id_add(
data.dsize = sizeof(ID); data.dsize = sizeof(ID);
flags = LDBM_INSERT; 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 ); rc = ldbm_cache_store( db, key, data, flags );
......
...@@ -48,7 +48,7 @@ id2entry_add( Backend *be, Entry *e ) ...@@ -48,7 +48,7 @@ id2entry_add( Backend *be, Entry *e )
/* store it */ /* store it */
flags = LDBM_REPLACE; 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 ); rc = ldbm_cache_store( db, key, data, flags );
pthread_mutex_unlock( &entry2str_mutex ); pthread_mutex_unlock( &entry2str_mutex );
......
...@@ -195,7 +195,7 @@ idl_store( ...@@ -195,7 +195,7 @@ idl_store(
#endif #endif
flags = LDBM_REPLACE; 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 ); rc = ldbm_cache_store( db, key, data, flags );
/* Debug( LDAP_DEBUG_TRACE, "<= idl_store %d\n", rc, 0, 0 ); */ /* Debug( LDAP_DEBUG_TRACE, "<= idl_store %d\n", rc, 0, 0 ); */
......
...@@ -34,6 +34,9 @@ ldbm_back_init( ...@@ -34,6 +34,9 @@ ldbm_back_init(
/* default database cache size */ /* default database cache size */
li->li_dbcachesize = DEFAULT_DBCACHE_SIZE; li->li_dbcachesize = DEFAULT_DBCACHE_SIZE;
/* default cache mode is sync on write */
li->li_dbcachewsync = 1;
/* default file creation mode */ /* default file creation mode */
li->li_mode = DEFAULT_MODE; li->li_mode = DEFAULT_MODE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment