Added experimental support for DB_DIRTY_READ.

This commit is contained in:
Howard Chu 2001-11-28 03:11:04 +00:00
parent f7e10947ca
commit 24d1ab848c
13 changed files with 34 additions and 18 deletions

View File

@ -70,7 +70,8 @@ retry: rc = txn_abort( ltid );
/* begin transaction */
if( bdb->bi_txn ) {
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 0 );
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid,
bdb->bi_db_opflags );
text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,

View File

@ -72,6 +72,7 @@ struct bdb_info {
int bi_ndatabases;
struct bdb_db_info **bi_databases;
ldap_pvt_thread_mutex_t bi_database_mutex;
int bi_db_opflags; /* db-specific flags */
slap_mask_t bi_defaultmask;
Avlnode *bi_attrs;

View File

@ -13,6 +13,7 @@
#include "back-bdb.h"
#define SLAP_BDB_ALLOW_DBNOTXN
#define SLAP_BDB_ALLOW_DIRTY_READ
int
bdb_db_config(
@ -48,6 +49,10 @@ bdb_db_config(
/* turn off transactions, use CDB mode instead */
} else if ( strcasecmp( argv[0], "dbnotxn" ) == 0 ) {
bdb->bi_txn = 0;
#endif
#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 ) {

View File

@ -73,7 +73,7 @@ bdb_db_cache(
rc = db->bdi_db->open( db->bdi_db,
file, name,
DB_BTREE, DB_CREATE|DB_THREAD,
DB_BTREE, bdb->bi_db_opflags | DB_CREATE | DB_THREAD,
bdb->bi_dbenv_mode );
ch_free( file );

View File

@ -50,7 +50,8 @@ retry: /* transaction retry */
if( bdb->bi_txn ) {
/* begin transaction */
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 0 );
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid,
bdb->bi_db_opflags );
text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,

View File

@ -210,7 +210,7 @@ bdb_dn2id(
data.flags = DB_DBT_USERMEM;
/* fetch it */
rc = db->get( db, txn, &key, &data, 0 );
rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags );
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id: get failed: %s (%d)\n",
@ -260,7 +260,7 @@ bdb_dn2id_matched(
*id = NOID;
/* fetch it */
rc = db->get( db, txn, &key, &data, 0 );
rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags );
if( rc == DB_NOTFOUND ) {
char *pdn = dn_parent( be, dn );
@ -339,7 +339,7 @@ bdb_dn2id_children(
data.doff = 0;
data.dlen = sizeof(id);
rc = db->get( db, txn, &key, &data, 0 );
rc = db->get( db, txn, &key, &data, bdb->bi_db_opflags );
Debug( LDAP_DEBUG_TRACE, "<= bdb_dn2id_children( %s ): %schildren (%d)\n",
dn,
@ -376,7 +376,7 @@ bdb_dn2idl(
data.flags = DB_DBT_USERMEM;
/* fetch it */
rc = db->get( db, NULL, &key, &data, 0 );
rc = db->get( db, NULL, &key, &data, bdb->bi_db_opflags );
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,

View File

@ -92,7 +92,7 @@ int bdb_id2entry(
data.flags = DB_DBT_MALLOC;
/* fetch it */
rc = db->get( db, tid, &key, &data, 0 );
rc = db->get( db, tid, &key, &data, bdb->bi_db_opflags );
if( rc != 0 ) {
return rc;

View File

@ -220,6 +220,7 @@ bdb_idl_fetch_key(
DBT *key,
ID *ids )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
int rc;
DBT data;
@ -231,7 +232,7 @@ bdb_idl_fetch_key(
data.flags = DB_DBT_USERMEM;
/* fetch it */
rc = db->get( db, tid, key, &data, 0 );
rc = db->get( db, tid, key, &data, bdb->bi_db_opflags );
if( rc == DB_NOTFOUND ) {
return rc;
@ -268,6 +269,7 @@ bdb_idl_insert_key(
DBT *key,
ID id )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
int rc;
ID ids[BDB_IDL_DB_SIZE];
DBT data;
@ -284,7 +286,7 @@ bdb_idl_insert_key(
data.flags = DB_DBT_USERMEM;
/* fetch the key for read/modify/write */
rc = db->get( db, tid, key, &data, DB_RMW );
rc = db->get( db, tid, key, &data, DB_RMW | bdb->bi_db_opflags );
if( rc == DB_NOTFOUND ) {
ids[0] = 1;
@ -358,6 +360,7 @@ bdb_idl_delete_key(
DBT *key,
ID id )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
int rc;
ID ids[BDB_IDL_DB_SIZE];
DBT data;
@ -374,7 +377,7 @@ bdb_idl_delete_key(
data.flags = DB_DBT_USERMEM;
/* fetch the key for read/modify/write */
rc = db->get( db, tid, key, &data, DB_RMW );
rc = db->get( db, tid, key, &data, DB_RMW | bdb->bi_db_opflags );
if ( rc != 0 ) {
Debug( LDAP_DEBUG_ANY, "=> bdb_idl_delete_key: "

View File

@ -210,7 +210,7 @@ bdb_db_open( BackendDB *be )
}
}
flags = DB_THREAD | DB_CREATE;
flags = DB_THREAD | DB_CREATE | bdb->bi_db_opflags;
bdb->bi_databases = (struct bdb_db_info **) ch_malloc(
BDB_INDICES * sizeof(struct bdb_db_info *) );

View File

@ -189,7 +189,8 @@ retry: /* transaction retry */
if( bdb->bi_txn ) {
/* begin transaction */
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 0 );
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid,
bdb->bi_db_opflags );
text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,

View File

@ -83,7 +83,8 @@ retry: /* transaction retry */
if( bdb->bi_txn ) {
/* begin transaction */
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 0 );
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid,
bdb->bi_db_opflags );
text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,

View File

@ -99,7 +99,8 @@ retry: /* transaction retry */
if( bdb->bi_txn ) {
/* begin transaction */
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 0 );
rc = txn_begin( bdb->bi_dbenv, NULL, &ltid,
bdb->bi_db_opflags );
*text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,

View File

@ -64,7 +64,8 @@ ID bdb_tool_entry_next(
if (cursor == NULL) {
rc = bdb->bi_id2entry->bdi_db->cursor(
bdb->bi_id2entry->bdi_db, NULL, &cursor, 0 );
bdb->bi_id2entry->bdi_db, NULL, &cursor,
bdb->bi_db_opflags );
if( rc != 0 ) {
return NOID;
}
@ -120,7 +121,8 @@ ID bdb_tool_entry_put(
(long) e->e_id, e->e_dn, 0 );
if( bdb->bi_txn ) {
rc = txn_begin( bdb->bi_dbenv, NULL, &tid, 0 );
rc = txn_begin( bdb->bi_dbenv, NULL, &tid,
bdb->bi_db_opflags );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_put: txn_begin failed: %s (%d)\n",
@ -208,7 +210,7 @@ int bdb_tool_entry_reindex(
}
if( bi->bi_txn ) {
rc = txn_begin( bi->bi_dbenv, NULL, &tid, 0 );
rc = txn_begin( bi->bi_dbenv, NULL, &tid, bi->bi_db_opflags );
if( rc != 0 ) {
Debug( LDAP_DEBUG_ANY,
"=> bdb_tool_entry_reindex: txn_begin failed: %s (%d)\n",