From 191853eb5171a11bc477edaf347cf13355b94cea Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 3 Oct 2001 23:28:20 +0000 Subject: [PATCH] An incremental step. --- servers/slapd/back-bdb/add.c | 2 +- servers/slapd/back-bdb/back-bdb.h | 3 ++- servers/slapd/back-bdb/init.c | 4 ++++ servers/slapd/back-bdb/modify.c | 4 ++-- servers/slapd/back-bdb/tools.c | 16 ++++++++++------ 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 92e3163a59..cbaa1394b2 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -240,7 +240,7 @@ retry: rc = txn_abort( ltid ); #if BDB_INDEX /* attribute indexes */ - if ( index_entry_add( be, e, e->e_attrs ) != LDAP_SUCCESS ) { + if ( bdb_index_entry_add( be, ltid, e, e->e_attrs ) != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "bdb_add: index_entry_add failed\n", 0, 0, 0 ); switch( rc ) { diff --git a/servers/slapd/back-bdb/back-bdb.h b/servers/slapd/back-bdb/back-bdb.h index 78a54900ed..ed45513c1f 100644 --- a/servers/slapd/back-bdb/back-bdb.h +++ b/servers/slapd/back-bdb/back-bdb.h @@ -15,7 +15,8 @@ LDAP_BEGIN_DECL -#define BBD_INDEX 1 +/* #define BDB_INDEX 1 */ +/* #define BDB_REINDEX 1 */ /* #define BDB_FILTER_INDICES 1 */ #define BDB_CONFIG_INDICES 1 diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index a61eeedc6f..2571ea1446 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -369,7 +369,11 @@ bdb_initialize( bi->bi_tool_entry_next = bdb_tool_entry_next; bi->bi_tool_entry_get = bdb_tool_entry_get; bi->bi_tool_entry_put = bdb_tool_entry_put; +#if BDB_REINDEX + bi->bi_tool_entry_reindex = bdb_tool_entry_reindex; +#else bi->bi_tool_entry_reindex = 0; +#endif bi->bi_tool_sync = 0; bi->bi_connection_init = 0; diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index b1044d59b9..d9fe477ccf 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -129,10 +129,10 @@ int bdb_modify_internal( #if BDB_INDEX /* delete indices for old attributes */ - rc = index_entry_del( be, tid, e, save_attrs); + rc = bdb_index_entry_del( be, tid, e, save_attrs); /* add indices for new attributes */ - rc = index_entry_add( be, tid, e, e->e_attrs); + rc = bdb_index_entry_add( be, tid, e, e->e_attrs); #endif attrs_free( save_attrs ); diff --git a/servers/slapd/back-bdb/tools.c b/servers/slapd/back-bdb/tools.c index 9a212c6291..be5a817362 100644 --- a/servers/slapd/back-bdb/tools.c +++ b/servers/slapd/back-bdb/tools.c @@ -184,28 +184,32 @@ done: return e->e_id; } -#if BDB_INDEX +#if BDB_REINDEX int bdb_tool_entry_reindex( BackendDB *be, ID id ) { - struct bdb_dbinfo *bdi = (struct bdb_dbinfo *) be->be_private; + struct bdb_info *bi = (struct bdb_info *) be->be_private; int rc; Entry *e; - DB_TXN *tid; + DB_TXN *tid = NULL; Debug( LDAP_DEBUG_ARGS, "=> bdb_tool_entry_reindex( %ld )\n", (long) id, 0, 0 ); - rc = txn_begin( bdi->bdi_db_env, NULL, &tid, 0 ); +#if 0 + rc = txn_begin( bi->bi_dbenv, NULL, &tid, 0 ); +#endif - e = bdb_tool_entry_get( be, tid, id ); + e = bdb_tool_entry_get( be, id ); if( e == NULL ) { Debug( LDAP_DEBUG_ANY, "bdb_tool_entry_reindex:: could not locate id=%ld\n", (long) id, 0, 0 ); +#if 0 txn_abort( tid ); +#endif return -1; } @@ -219,7 +223,7 @@ int bdb_tool_entry_reindex( Debug( LDAP_DEBUG_TRACE, "=> bdb_tool_entry_reindex( %ld, \"%s\" )\n", id, e->e_dn, 0 ); - rc = index_entry_add( be, e, e->e_attrs ); + rc = bdb_index_entry_add( be, tid, e, e->e_attrs ); entry_free( e ); -- 2.39.5