Avoid deadlocks on reader txns

This commit is contained in:
Howard Chu 2008-08-27 22:28:16 +00:00
parent d7109e0f56
commit e5b96f2c76
2 changed files with 3 additions and 3 deletions

View File

@ -1481,7 +1481,7 @@ bdb_reader_get( Operation *op, DB_ENV *env, DB_TXN **txn )
if ( ldap_pvt_thread_pool_getkey( ctx, env, &data, NULL ) ) { if ( ldap_pvt_thread_pool_getkey( ctx, env, &data, NULL ) ) {
for ( i=0, rc=1; rc != 0 && i<4; i++ ) { for ( i=0, rc=1; rc != 0 && i<4; i++ ) {
rc = TXN_BEGIN( env, NULL, txn, DB_READ_COMMITTED ); rc = TXN_BEGIN( env, NULL, txn, DB_READ_COMMITTED | DB_TXN_NOWAIT );
if (rc) ldap_pvt_thread_yield(); if (rc) ldap_pvt_thread_yield();
} }
if ( rc != 0) { if ( rc != 0) {

View File

@ -61,7 +61,7 @@ bdb_db_init( BackendDB *be, ConfigReply *cr )
/* DBEnv parameters */ /* DBEnv parameters */
bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR ); bdb->bi_dbenv_home = ch_strdup( SLAPD_DEFAULT_DB_DIR );
bdb->bi_dbenv_xflags = 0; bdb->bi_dbenv_xflags = DB_TIME_NOTGRANTED;
bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE; bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE;
bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE; bdb->bi_cache.c_maxsize = DEFAULT_CACHE_SIZE;
@ -503,7 +503,7 @@ shm_retry:
} }
if ( !quick ) { if ( !quick ) {
TXN_BEGIN(bdb->bi_dbenv, NULL, &bdb->bi_cache.c_txn, DB_READ_COMMITTED); TXN_BEGIN(bdb->bi_dbenv, NULL, &bdb->bi_cache.c_txn, DB_READ_COMMITTED | DB_TXN_NOWAIT);
} }
entry_prealloc( bdb->bi_cache.c_maxsize ); entry_prealloc( bdb->bi_cache.c_maxsize );