mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
Add shm_key config keyword to use shared memory for BDB environment
Unmeasurable performance difference on my tests, but who knows...
This commit is contained in:
parent
d4a9e0ece0
commit
6fd41cd254
@ -157,6 +157,7 @@ struct bdb_info {
|
||||
u_int32_t bi_txn_cp_kbyte;
|
||||
|
||||
int bi_lock_detect;
|
||||
long bi_shm_key;
|
||||
|
||||
ID bi_lastid;
|
||||
ldap_pvt_thread_mutex_t bi_lastid_mutex;
|
||||
|
@ -50,7 +50,7 @@ bdb_db_config(
|
||||
} else if ( strcasecmp( argv[0], "dirtyread" ) == 0 ) {
|
||||
bdb->bi_db_opflags |= DB_DIRTY_READ;
|
||||
#endif
|
||||
/* transaction checkpoint configuration */
|
||||
/* transaction logging configuration */
|
||||
} else if ( strcasecmp( argv[0], "dbnosync" ) == 0 ) {
|
||||
bdb->bi_dbenv_xflags |= DB_TXN_NOSYNC;
|
||||
|
||||
@ -125,6 +125,16 @@ bdb_db_config(
|
||||
|
||||
if( rc != LDAP_SUCCESS ) return 1;
|
||||
|
||||
/* unique key for shared memory regions */
|
||||
} else if ( strcasecmp( argv[0], "shm_key" ) == 0 ) {
|
||||
if ( argc < 2 ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: missing key in \"shm_key <key>\" line\n",
|
||||
fname, lineno );
|
||||
return( 1 );
|
||||
}
|
||||
bdb->bi_shm_key = atoi( argv[1] );
|
||||
|
||||
/* size of the cache in entries */
|
||||
} else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
|
||||
if ( argc < 2 ) {
|
||||
|
@ -194,6 +194,12 @@ bdb_db_open( BackendDB *be )
|
||||
if( !(slapMode & SLAP_TOOL_MODE) ) flags |= DB_RECOVER;
|
||||
#endif
|
||||
|
||||
/* If a key was set, use shared memory for the BDB environment */
|
||||
if ( bdb->bi_shm_key ) {
|
||||
bdb->bi_dbenv->set_shm_key( bdb->bi_dbenv, bdb->bi_shm_key );
|
||||
flags |= DB_SYSTEM_MEM;
|
||||
}
|
||||
|
||||
bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
|
||||
bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
|
||||
bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
|
||||
|
Loading…
Reference in New Issue
Block a user