Delayed backend lock release to replog entry after successful add().

This commit is contained in:
Kurt Spanier 1999-04-19 10:47:03 +00:00
parent 3041aafc2c
commit f1e7ffb176
3 changed files with 24 additions and 9 deletions

View File

@ -11,6 +11,9 @@
#include "back-bdb2.h"
#include "proto-back-bdb2.h"
static DB_LOCK lock;
static int
bdb2i_back_add_internal(
BackendDB *be,
@ -217,7 +220,7 @@ return_results:;
bdb2i_cache_return_entry_w( &li->li_cache, p );
}
if ( 1 || rc ) {
if ( rc ) {
/* free entry and writer lock */
bdb2i_cache_return_entry_w( &li->li_cache, e );
}
@ -234,9 +237,8 @@ bdb2_back_add(
Entry *e
)
{
DB_LOCK lock;
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
struct timeval time1, time2;
struct timeval time1;
int ret;
bdb2i_start_timing( be->bd_info, &time1 );
@ -248,8 +250,6 @@ bdb2_back_add(
}
bdb2i_start_timing( be->bd_info, &time2 );
/* check, if a new default attribute index will be created,
in which case we have to open the index file BEFORE TP */
switch ( slapMode ) {
@ -262,11 +262,22 @@ bdb2_back_add(
}
ret = bdb2i_back_add_internal( be, conn, op, e );
bdb2i_stop_timing( be->bd_info, time2, "ADD-INTERN", conn, op );
(void) bdb2i_leave_backend_w( lock );
/* if the operation was successful, we will delay the unlock */
if ( ret )
(void) bdb2i_leave_backend_w( lock );
bdb2i_stop_timing( be->bd_info, time1, "ADD", conn, op );
return( ret );
}
int
bdb2i_release_add_lock( void )
{
(void) bdb2i_leave_backend_w( lock );
return 0;
}

View File

@ -19,12 +19,11 @@ bdb2_back_entry_release_rw(
int rw
)
{
#if 0
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
/* free entry and reader or writer lock */
bdb2i_cache_return_entry_rw( &li->li_cache, e, rw );
#endif
bdb2i_release_add_lock();
return 0;
}

View File

@ -9,6 +9,11 @@
LDAP_BEGIN_DECL
/*
* add.c
*/
int bdb2i_release_add_lock LDAP_P(());
/*
* alias.c
*/