Skip to content
Snippets Groups Projects
Commit f1e7ffb1 authored by Kurt Spanier's avatar Kurt Spanier
Browse files

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

parent 3041aafc
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
#include "back-bdb2.h" #include "back-bdb2.h"
#include "proto-back-bdb2.h" #include "proto-back-bdb2.h"
static DB_LOCK lock;
static int static int
bdb2i_back_add_internal( bdb2i_back_add_internal(
BackendDB *be, BackendDB *be,
...@@ -217,7 +220,7 @@ return_results:; ...@@ -217,7 +220,7 @@ return_results:;
bdb2i_cache_return_entry_w( &li->li_cache, p ); bdb2i_cache_return_entry_w( &li->li_cache, p );
} }
if ( 1 || rc ) { if ( rc ) {
/* free entry and writer lock */ /* free entry and writer lock */
bdb2i_cache_return_entry_w( &li->li_cache, e ); bdb2i_cache_return_entry_w( &li->li_cache, e );
} }
...@@ -234,9 +237,8 @@ bdb2_back_add( ...@@ -234,9 +237,8 @@ bdb2_back_add(
Entry *e Entry *e
) )
{ {
DB_LOCK lock;
struct ldbminfo *li = (struct ldbminfo *) be->be_private; struct ldbminfo *li = (struct ldbminfo *) be->be_private;
struct timeval time1, time2; struct timeval time1;
int ret; int ret;
bdb2i_start_timing( be->bd_info, &time1 ); bdb2i_start_timing( be->bd_info, &time1 );
...@@ -248,8 +250,6 @@ bdb2_back_add( ...@@ -248,8 +250,6 @@ bdb2_back_add(
} }
bdb2i_start_timing( be->bd_info, &time2 );
/* check, if a new default attribute index will be created, /* check, if a new default attribute index will be created,
in which case we have to open the index file BEFORE TP */ in which case we have to open the index file BEFORE TP */
switch ( slapMode ) { switch ( slapMode ) {
...@@ -262,11 +262,22 @@ bdb2_back_add( ...@@ -262,11 +262,22 @@ bdb2_back_add(
} }
ret = bdb2i_back_add_internal( be, conn, op, e ); 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 ); bdb2i_stop_timing( be->bd_info, time1, "ADD", conn, op );
return( ret ); return( ret );
} }
int
bdb2i_release_add_lock( void )
{
(void) bdb2i_leave_backend_w( lock );
return 0;
}
...@@ -19,12 +19,11 @@ bdb2_back_entry_release_rw( ...@@ -19,12 +19,11 @@ bdb2_back_entry_release_rw(
int rw int rw
) )
{ {
#if 0
struct ldbminfo *li = (struct ldbminfo *) be->be_private; struct ldbminfo *li = (struct ldbminfo *) be->be_private;
/* free entry and reader or writer lock */ /* free entry and reader or writer lock */
bdb2i_cache_return_entry_rw( &li->li_cache, e, rw ); bdb2i_cache_return_entry_rw( &li->li_cache, e, rw );
#endif bdb2i_release_add_lock();
return 0; return 0;
} }
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
LDAP_BEGIN_DECL LDAP_BEGIN_DECL
/*
* add.c
*/
int bdb2i_release_add_lock LDAP_P(());
/* /*
* alias.c * alias.c
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment