]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/config.c
Memory context tweaks for other ops
[openldap] / servers / slapd / back-bdb / config.c
index f56b8cc2a8a55a79ad9efd480fc94026a4f03a48..12bf4d73244bc22141cde250ec548262d34c225d 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-2003 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,8 +46,15 @@ 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;
 
-       /* mode with which to create new database files */
+       /* transaction checkpoint configuration */
        } else if ( strcasecmp( argv[0], "checkpoint" ) == 0 ) {
                if ( argc < 3 ) {
                        fprintf( stderr, "%s: line %d: "
@@ -55,6 +66,37 @@ bdb_db_config(
                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 ) {
+               if ( argc < 2 ) {
+                       fprintf( stderr, "%s: line %d: "
+                               "missing parameters in \"lockDetect <policy>\" 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 <policy>\" line\n",
+                               fname, lineno, argv[1] );
+                       return 1;
+               }
+
        /* mode with which to create new database files */
        } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
                if ( argc < 2 ) {
@@ -65,7 +107,6 @@ bdb_db_config(
                }
                bdb->bi_dbenv_mode = strtol( argv[1], NULL, 0 );
 
-#if 0
        /* attribute to index */
        } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
                int rc;
@@ -80,9 +121,48 @@ bdb_db_config(
                                "line (ignored)\n",
                                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;
+
+       /* 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] );
+
+       /* depth of search stack cache in units of (IDL)s */
+        } else if ( strcasecmp( argv[0], "searchstack" ) == 0 ) {
+               if ( argc < 2 ) {
+                       fprintf( stderr,
+               "%s: line %d: missing depth in \"searchstack <depth>\" line\n",
+                       fname, lineno );
+                       return( 1 );
+               }
+               bdb->bi_search_stack_depth = atoi( argv[1] );
+               if ( bdb->bi_search_stack_depth < MINIMUM_SEARCH_STACK_DEPTH ) {
+                       fprintf( stderr,
+               "%s: line %d: depth %d too small, using %d\n",
+                       fname, lineno, bdb->bi_search_stack_depth,
+                       MINIMUM_SEARCH_STACK_DEPTH );
+                       bdb->bi_search_stack_depth = MINIMUM_SEARCH_STACK_DEPTH;
+               }
+
+#ifdef SLAP_IDL_CACHE
+       /* size of the IDL cache in entries */
+        } else if ( strcasecmp( argv[0], "idlcachesize" ) == 0 ) {
+                 if ( argc < 2 ) {
+                         fprintf( stderr,
+                 "%s: line %d: missing size in \"idlcachesize <size>\" line\n",
+                             fname, lineno );
+                         return( 1 );
+                 }
+                if ( !( slapMode & SLAP_TOOL_MODE ) )
+                        bdb->bi_idl_cache_max_size = atoi( argv[1] );
 #endif
 
        /* anything else */