X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-bdb%2Fconfig.c;h=bd74e95e8c32f39f3bb19f0b8faa22ab72cba048;hb=08059f1633bfd9d0a709761b026bdb8e4441c6e6;hp=c881bec9232b2d7bca8a7e0505cbddc8fe590c75;hpb=c182511f913038bf74a0bf9c0999219580030bae;p=openldap
diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c
index c881bec923..bd74e95e8c 100644
--- a/servers/slapd/back-bdb/config.c
+++ b/servers/slapd/back-bdb/config.c
@@ -1,7 +1,7 @@
-/* config.c - ldbm backend configuration file routine */
+/* config.c - bdb backend configuration file routine */
/* $OpenLDAP$ */
/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
@@ -12,20 +12,24 @@
#include "back-bdb.h"
+#ifdef DB_DIRTY_READ
+# define SLAP_BDB_ALLOW_DIRTY_READ
+#endif
+
int
bdb_db_config(
- BackendDB *be,
- const char *fname,
- int lineno,
- int argc,
- char **argv )
+ BackendDB *be,
+ const char *fname,
+ int lineno,
+ int argc,
+ char **argv )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
if ( bdb == NULL ) {
fprintf( stderr, "%s: line %d: "
"bdb database info is null!\n",
- fname, lineno );
+ fname, lineno );
return 1;
}
@@ -34,7 +38,7 @@ bdb_db_config(
if ( argc < 2 ) {
fprintf( stderr, "%s: line %d: "
"missing dir in \"directory
\" line\n",
- fname, lineno );
+ fname, lineno );
return 1;
}
if ( bdb->bi_dbenv_home ) {
@@ -42,41 +46,114 @@ bdb_db_config(
}
bdb->bi_dbenv_home = ch_strdup( argv[1] );
+#ifdef SLAP_BDB_ALLOW_DIRTY_READ
+ } else if ( strcasecmp( argv[0], "dirtyread" ) == 0 ) {
+ bdb->bi_db_opflags |= DB_DIRTY_READ;
+#endif
+ /* transaction checkpoint configuration */
+ } else if ( strcasecmp( argv[0], "dbnosync" ) == 0 ) {
+ bdb->bi_dbenv_xflags |= DB_TXN_NOSYNC;
+
+ /* transaction checkpoint configuration */
+ } else if ( strcasecmp( argv[0], "checkpoint" ) == 0 ) {
+ if ( argc < 3 ) {
+ fprintf( stderr, "%s: line %d: "
+ "missing parameters in \"checkpoint \" line\n",
+ fname, lineno );
+ return 1;
+ }
+ bdb->bi_txn_cp = 1;
+ bdb->bi_txn_cp_kbyte = strtol( argv[1], NULL, 0 );
+ bdb->bi_txn_cp_min = strtol( argv[2], NULL, 0 );
+
+ /* lock detect configuration */
+ } else if ( strcasecmp( argv[0], "lockdetect" ) == 0 ) {
+#ifndef NO_THREADS
+ if ( argc < 3 ) {
+ fprintf( stderr, "%s: line %d: "
+ "missing parameters in \"lockDetect \" line\n",
+ fname, lineno );
+ return 1;
+ }
+
+ if( strcasecmp( argv[1], "default" ) == 0 ) {
+ bdb->bi_lock_detect = DB_LOCK_DEFAULT;
+
+ } else if( strcasecmp( argv[1], "oldest" ) == 0 ) {
+ bdb->bi_lock_detect = DB_LOCK_OLDEST;
+
+ } else if( strcasecmp( argv[1], "random" ) == 0 ) {
+ bdb->bi_lock_detect = DB_LOCK_RANDOM;
+
+ } else if( strcasecmp( argv[1], "youngest" ) == 0 ) {
+ bdb->bi_lock_detect = DB_LOCK_YOUNGEST;
+
+ } else if( strcasecmp( argv[1], "fewest" ) == 0 ) {
+ bdb->bi_lock_detect = DB_LOCK_MINLOCKS;
+
+ } else {
+ fprintf( stderr, "%s: line %d: "
+ "bad policy (%s) in \"lockDetect \" line\n",
+ fname, lineno, argv[1] );
+ return 1;
+ }
+
+ bdb->bi_lock_detect_seconds = strtol( argv[2], NULL, 0 );
+ if( bdb->bi_lock_detect_seconds < 1 ) {
+ fprintf( stderr, "%s: line %d: "
+ "bad seconds (%s) in \"lockDetect \" line\n",
+ fname, lineno, argv[2] );
+ return 1;
+ }
+#else
+ fprintf( stderr, "%s: line %d: "
+ "NO THREADS: lockDetect line ignored\n",
+ fname, lineno );
+#endif
+
/* mode with which to create new database files */
} else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
if ( argc < 2 ) {
fprintf( stderr, "%s: line %d: "
"missing mode in \"mode \" line\n",
- fname, lineno );
+ fname, lineno );
return 1;
}
bdb->bi_dbenv_mode = strtol( argv[1], NULL, 0 );
-#if 0
/* attribute to index */
} else if ( strcasecmp( argv[0], "index" ) == 0 ) {
int rc;
if ( argc < 2 ) {
fprintf( stderr, "%s: line %d: "
"missing attr in \"index [pres,eq,approx,sub]\" line\n",
- fname, lineno );
+ fname, lineno );
return 1;
} else if ( argc > 3 ) {
fprintf( stderr, "%s: line %d: "
"extra junk after \"index [pres,eq,approx,sub]\" "
"line (ignored)\n",
- fname, lineno );
+ fname, lineno );
}
- rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1] );
+ rc = bdb_attr_index_config( bdb, fname, lineno, argc - 1, &argv[1] );
if( rc != LDAP_SUCCESS ) return 1;
-#endif
+
+ /* size of the cache in entries */
+ } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
+ if ( argc < 2 ) {
+ fprintf( stderr,
+ "%s: line %d: missing size in \"cachesize \" line\n",
+ fname, lineno );
+ return( 1 );
+ }
+ bdb->bi_cache.c_maxsize = atoi( argv[1] );
/* anything else */
} else {
fprintf( stderr, "%s: line %d: "
"unknown directive \"%s\" in bdb database definition (ignored)\n",
- fname, lineno, argv[0] );
+ fname, lineno, argv[0] );
}
return 0;