Add config keyword for DN cache size (aka EntryInfoSize)

default is 2x entry cache size
This commit is contained in:
Howard Chu 2007-08-11 19:29:14 +00:00
parent fa6aeb37bd
commit 8b27523e4c
5 changed files with 23 additions and 10 deletions

View File

@ -131,6 +131,7 @@ typedef struct bdb_cache {
int c_maxsize;
int c_cursize;
int c_minfree;
int c_eimax;
int c_eiused; /* EntryInfo's in use */
int c_leaves; /* EntryInfo leaf nodes */
int c_purging;
@ -288,6 +289,8 @@ struct __db_locker {
u_int32_t id;
};
extern int __lock_getlocker(DB_LOCKTAB *lt, u_int32_t locker, int create, DB_LOCKER **ret);
#define CURSOR_SETLOCKER(cursor, id) \
__lock_getlocker(cursor->dbp->dbenv->lk_handle, id, 0, &cursor->locker)
#define CURSOR_GETLOCKER(cursor) cursor->locker->id

View File

@ -631,7 +631,7 @@ bdb_cache_lru_purge( struct bdb_info *bdb )
if ( slapMode & SLAP_TOOL_READONLY )
eimax = 0;
else
eimax = bdb->bi_cache.c_maxsize * 4;
eimax = bdb->bi_cache.c_eimax;
/* Look for an unused entry to remove */
for ( elru = bdb->bi_cache.c_lruhead; elru; elru = elnext ) {

View File

@ -86,6 +86,11 @@ static ConfigTable bdbcfg[] = {
"( OLcfgDbAt:1.5 NAME 'olcDbDirtyRead' "
"DESC 'Allow reads of uncommitted data' "
"SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
{ "dncachesize", "size", 2, 2, 0, ARG_INT|ARG_OFFSET,
(void *)offsetof(struct bdb_info, bi_cache.c_eimax),
"( OLcfgDbAt:1.12 NAME 'olcDbDNcacheSize' "
"DESC 'DN cache size' "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
{ "idlcachesize", "size", 2, 2, 0, ARG_INT|ARG_OFFSET,
(void *)offsetof(struct bdb_info,bi_idl_cache_max_size),
"( OLcfgDbAt:1.6 NAME 'olcDbIDLcacheSize' "
@ -140,7 +145,7 @@ static ConfigOCs bdbocs[] = {
"olcDbNoSync $ olcDbDirtyRead $ olcDbIDLcacheSize $ "
"olcDbIndex $ olcDbLinearIndex $ olcDbLockDetect $ "
"olcDbMode $ olcDbSearchStack $ olcDbShmKey $ "
"olcDbCacheFree ) )",
"olcDbCacheFree $ olcDbDNcacheSize ) )",
Cft_Database, bdbcfg },
{ NULL, 0, NULL }
};

View File

@ -301,7 +301,7 @@ shm_retry:
flags | do_recover, bdb->bi_dbenv_mode );
if ( rc ) {
/* Regular open faied, probably a missing shm environment.
/* Regular open failed, probably a missing shm environment.
* Start over, do a recovery.
*/
if ( !do_recover && bdb->bi_shm_key ) {
@ -337,6 +337,11 @@ shm_retry:
}
#endif
/* Default dncache to 2x entrycache */
if ( bdb->bi_cache.c_maxsize && !bdb->bi_cache.c_eimax ) {
bdb->bi_cache.c_eimax = bdb->bi_cache.c_maxsize * 2;
}
if ( bdb->bi_idl_cache_max_size ) {
bdb->bi_idl_tree = NULL;
bdb->bi_idl_cache_size = 0;

View File

@ -32,7 +32,7 @@
static ObjectClass *oc_olmBDBDatabase;
static AttributeDescription *ad_olmBDBEntryCache,
*ad_olmBDBEntryInfo, *ad_olmBDBIDLCache,
*ad_olmBDBDNCache, *ad_olmBDBIDLCache,
*ad_olmDbDirectory;
#ifdef BDB_MONITOR_IDX
@ -80,12 +80,12 @@ static struct {
&ad_olmBDBEntryCache },
{ "( olmBDBAttributes:2 "
"NAME ( 'olmBDBEntryInfo' ) "
"DESC 'Number of items in EntryInfo Cache' "
"NAME ( 'olmBDBDNCache' ) "
"DESC 'Number of items in DN Cache' "
"SUP monitorCounter "
"NO-USER-MODIFICATION "
"USAGE dSAOperation )",
&ad_olmBDBEntryInfo },
&ad_olmBDBDNCache },
{ "( olmBDBAttributes:3 "
"NAME ( 'olmBDBIDLCache' ) "
@ -128,7 +128,7 @@ static struct {
"SUP top AUXILIARY "
"MAY ( "
"olmBDBEntryCache "
"$ olmBDBEntryInfo "
"$ olmBDBDNCache "
"$ olmBDBIDLCache "
"$ olmDbDirectory "
#ifdef BDB_MONITOR_IDX
@ -161,7 +161,7 @@ bdb_monitor_update(
bv.bv_len = snprintf( buf, sizeof( buf ), "%d", bdb->bi_cache.c_cursize );
ber_bvreplace( &a->a_vals[ 0 ], &bv );
a = attr_find( e->e_attrs, ad_olmBDBEntryInfo );
a = attr_find( e->e_attrs, ad_olmBDBDNCache );
assert( a != NULL );
bv.bv_len = snprintf( buf, sizeof( buf ), "%d", bdb->bi_cache.c_eiused );
ber_bvreplace( &a->a_vals[ 0 ], &bv );
@ -425,7 +425,7 @@ bdb_monitor_db_open( BackendDB *be )
next->a_nvals = next->a_vals;
next = next->a_next;
next->a_desc = ad_olmBDBEntryInfo;
next->a_desc = ad_olmBDBDNCache;
value_add_one( &next->a_vals, &bv );
next->a_nvals = next->a_vals;
next = next->a_next;