]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/config.c
Never let ldif_parse_line() return a NULL value with success.
[openldap] / servers / slapd / back-bdb / config.c
index f9a66fcc638c5a4f5283f75b5087d34bf5e4683a..90f99672f38a5cc71f6ce3a5b9baf5649f577f65 100644 (file)
@@ -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
  */
 
 
 #include "back-bdb.h"
 
+#ifdef DB_DIRTY_READ
+#      define  SLAP_BDB_ALLOW_DIRTY_READ
+#endif
+
 int
 bdb_db_config(
        BackendDB       *be,
@@ -42,7 +46,10 @@ 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;
@@ -61,10 +68,9 @@ bdb_db_config(
 
        /* lock detect configuration */
        } else if ( strcasecmp( argv[0], "lockdetect" ) == 0 ) {
-#ifndef NO_THREADS
-               if ( argc < 3 ) {
+               if ( argc < 2 ) {
                        fprintf( stderr, "%s: line %d: "
-                               "missing parameters in \"lockDetect <policy> <seconds>\" line\n",
+                               "missing parameters in \"lockDetect <policy>\" line\n",
                                fname, lineno );
                        return 1;
                }
@@ -81,26 +87,16 @@ bdb_db_config(
                } 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 <policy> <seconds>\" line\n",
+                               "bad policy (%s) in \"lockDetect <policy>\" 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 <policy> <seconds>\" 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 ) {
@@ -111,7 +107,6 @@ bdb_db_config(
                }
                bdb->bi_dbenv_mode = strtol( argv[1], NULL, 0 );
 
-#if BDB_CONFIG_INDICES
        /* attribute to index */
        } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
                int rc;
@@ -129,7 +124,16 @@ bdb_db_config(
                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 <size>\" line\n",
+                             fname, lineno );
+                         return( 1 );
+                 }
+                 bdb->bi_cache.c_maxsize = atoi( argv[1] );
 
        /* anything else */
        } else {