From a0c58e5f408bab28c1836ccf84a3d688bd752e6e Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 18 Mar 2003 00:04:16 +0000 Subject: [PATCH] Don't use DB_AUTO_COMMIT when opening a database --- servers/slapd/back-bdb/back-bdb.h | 8 ++++---- servers/slapd/back-bdb/dbcache.c | 3 ++- servers/slapd/back-bdb/index.c | 4 ++-- servers/slapd/back-bdb/init.c | 4 ++-- servers/slapd/back-bdb/proto-bdb.h | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index f3df2ae082..b7a5e5c253 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -14,7 +14,7 @@ LDAP_BEGIN_DECL -/* #define BDB_HIER 1 */ +#define BDB_HIER 1 #define DN_BASE_PREFIX SLAP_INDEX_EQUALITY_PREFIX #define DN_ONE_PREFIX '%' @@ -160,7 +160,7 @@ struct bdb_op_info { int boi_acl_cache; }; -#define DB_OPEN(db, file, name, type, flags, mode) \ +#define DB_OPEN(db, txn, file, name, type, flags, mode) \ (db)->open(db, file, name, type, flags, mode) #if DB_VERSION_MAJOR < 4 @@ -191,8 +191,8 @@ struct bdb_op_info { /* BDB 4.1.17 adds txn arg to db->open */ #if DB_VERSION_MINOR > 1 || DB_VERSION_PATCH >= 17 #undef DB_OPEN -#define DB_OPEN(db, file, name, type, flags, mode) \ - (db)->open(db, NULL, file, name, type, (flags)|DB_AUTO_COMMIT, mode) +#define DB_OPEN(db, txn, file, name, type, flags, mode) \ + (db)->open(db, txn, file, name, type, flags, mode) #endif #define BDB_REUSE_LOCKERS diff --git a/servers/slapd/back-bdb/dbcache.c b/servers/slapd/back-bdb/dbcache.c index 7f5d6718d0..a9ac40efa5 100644 --- a/servers/slapd/back-bdb/dbcache.c +++ b/servers/slapd/back-bdb/dbcache.c @@ -46,6 +46,7 @@ bdb_db_hash( int bdb_db_cache( Backend *be, + DB_TXN *tid, const char *name, DB **dbout ) { @@ -110,7 +111,7 @@ bdb_db_cache( #ifdef HAVE_EBCDIC __atoe( file ); #endif - rc = DB_OPEN( db->bdi_db, + rc = DB_OPEN( db->bdi_db, tid, file, name, DB_HASH, bdb->bi_db_opflags | DB_CREATE | DB_THREAD, bdb->bi_dbenv_mode ); diff --git a/servers/slapd/back-bdb/index.c b/servers/slapd/back-bdb/index.c index 1120054eb3..86c777ef16 100644 --- a/servers/slapd/back-bdb/index.c +++ b/servers/slapd/back-bdb/index.c @@ -103,7 +103,7 @@ int bdb_index_param( return LDAP_INAPPROPRIATE_MATCHING; } - rc = bdb_db_cache( be, dbname, &db ); + rc = bdb_db_cache( be, NULL, dbname, &db ); if( rc != LDAP_SUCCESS ) { return rc; @@ -165,7 +165,7 @@ static int indexer( assert( mask ); - rc = bdb_db_cache( be, dbname, &db ); + rc = bdb_db_cache( be, txn, dbname, &db ); if ( rc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 7d6dae13f0..ec95cfc42b 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -380,14 +380,14 @@ bdb_db_open( BackendDB *be ) #ifdef HAVE_EBCDIC strcpy( path, bdbi_databases[i].file ); __atoe( path ); - rc = DB_OPEN( db->bdi_db, + rc = DB_OPEN( db->bdi_db, NULL, path, /* bdbi_databases[i].name, */ NULL, bdbi_databases[i].type, bdbi_databases[i].flags | flags, bdb->bi_dbenv_mode ); #else - rc = DB_OPEN( db->bdi_db, + rc = DB_OPEN( db->bdi_db, NULL, bdbi_databases[i].file, /* bdbi_databases[i].name, */ NULL, bdbi_databases[i].type, diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index 01103d1585..8cb1ed5808 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -51,6 +51,7 @@ BI_acl_attribute bdb_attribute; int bdb_db_cache( Backend *be, + DB_TXN *tid, const char *name, DB **db ); -- 2.39.5