/* begin transaction */
if( bdb->bi_txn ) {
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id,
+ bdb->bi_db_opflags );
text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
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;
#include "back-bdb.h"
#define SLAP_BDB_ALLOW_DBNOTXN
+#define SLAP_BDB_ALLOW_DIRTY_READ
int
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 ) {
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 );
if( bdb->bi_txn ) {
/* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id,
+ bdb->bi_db_opflags );
text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
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",
*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 );
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,
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,
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;
DBT *key,
ID *ids )
{
+ struct bdb_info *bdb = (struct bdb_info *) be->be_private;
int rc;
DBT data;
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;
DBT *key,
ID id )
{
+ struct bdb_info *bdb = (struct bdb_info *) be->be_private;
int rc;
ID ids[BDB_IDL_DB_SIZE];
DBT data;
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;
DBT *key,
ID id )
{
+ struct bdb_info *bdb = (struct bdb_info *) be->be_private;
int rc;
ID ids[BDB_IDL_DB_SIZE];
DBT data;
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: "
}
}
- 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 *) );
if( bdb->bi_txn ) {
/* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id,
+ bdb->bi_db_opflags );
text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
if( bdb->bi_txn ) {
/* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id,
+ bdb->bi_db_opflags );
text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
if( bdb->bi_txn ) {
/* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id, 0 );
+ rc = txn_begin( bdb->bi_dbenv, NULL, <id,
+ bdb->bi_db_opflags );
*text = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
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;
}
(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",
}
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",