Slight adaption of concurrency-test to enable even more writers/readers.
Debug(LDAP_DEBUG_ARGS, "==> bdb2i_back_add: %s\n", e->e_dn, 0, 0);
/* nobody else can add until we lock our parent */
Debug(LDAP_DEBUG_ARGS, "==> bdb2i_back_add: %s\n", e->e_dn, 0, 0);
/* nobody else can add until we lock our parent */
- ldap_pvt_thread_mutex_lock(&li->li_add_mutex);
+ /* DDD ldap_pvt_thread_mutex_lock(&li->li_add_mutex); */
if ( ( bdb2i_dn2id( be, e->e_ndn ) ) != NOID ) {
if ( ( bdb2i_dn2id( be, e->e_ndn ) ) != NOID ) {
- ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_add_mutex); */
entry_free( e );
send_ldap_result( conn, op, LDAP_ALREADY_EXISTS, "", "" );
return( -1 );
}
if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
entry_free( e );
send_ldap_result( conn, op, LDAP_ALREADY_EXISTS, "", "" );
return( -1 );
}
if ( global_schemacheck && oc_schema_check( e ) != 0 ) {
- ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_add_mutex); */
Debug( LDAP_DEBUG_TRACE, "entry failed schema check\n",
0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "entry failed schema check\n",
0, 0, 0 );
/* get parent with writer lock */
if ( (p = bdb2i_dn2entry_w( be, pdn, &matched )) == NULL ) {
/* get parent with writer lock */
if ( (p = bdb2i_dn2entry_w( be, pdn, &matched )) == NULL ) {
- ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_add_mutex); */
Debug( LDAP_DEBUG_TRACE, "parent does not exist\n", 0,
0, 0 );
send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
Debug( LDAP_DEBUG_TRACE, "parent does not exist\n", 0,
0, 0 );
send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
}
/* don't need the add lock anymore */
}
/* don't need the add lock anymore */
- ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_add_mutex); */
} else {
/* no parent, must be adding entry to root */
if ( ! be_isroot( be, op->o_ndn ) ) {
} else {
/* no parent, must be adding entry to root */
if ( ! be_isroot( be, op->o_ndn ) ) {
- ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_add_mutex); */
Debug( LDAP_DEBUG_TRACE, "no parent & not root\n", 0,
0, 0 );
send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
Debug( LDAP_DEBUG_TRACE, "no parent & not root\n", 0,
0, 0 );
send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
* no parent, acquire the root write lock
* and release the add lock.
*/
* no parent, acquire the root write lock
* and release the add lock.
*/
- ldap_pvt_thread_mutex_lock(&li->li_root_mutex);
+ /* DDD ldap_pvt_thread_mutex_lock(&li->li_root_mutex); */
- ldap_pvt_thread_mutex_unlock(&li->li_add_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_add_mutex); */
}
e->e_id = bdb2i_next_id( be );
}
e->e_id = bdb2i_next_id( be );
if ( rootlock ) {
/* release root lock */
if ( rootlock ) {
/* release root lock */
- ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_root_mutex); */
}
Debug( LDAP_DEBUG_ANY, "cache_add_entry_lock failed\n", 0, 0,
}
Debug( LDAP_DEBUG_ANY, "cache_add_entry_lock failed\n", 0, 0,
if ( rootlock ) {
/* release root lock */
if ( rootlock ) {
/* release root lock */
- ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_root_mutex); */
}
/* free entry and writer lock */
}
/* free entry and writer lock */
Avlnode *c_idtree;
Entry *c_lruhead; /* lru - add accessed entries here */
Entry *c_lrutail; /* lru - rem lru entries from here */
Avlnode *c_idtree;
Entry *c_lruhead; /* lru - add accessed entries here */
Entry *c_lrutail; /* lru - rem lru entries from here */
- ldap_pvt_thread_mutex_t c_mutex;
+ /* DDD ldap_pvt_thread_mutex_t c_mutex; */
};
#define CACHE_READ_LOCK 1
};
#define CACHE_READ_LOCK 1
ID li_nextid_wrote;
#endif
char *li_nextid_file;
ID li_nextid_wrote;
#endif
char *li_nextid_file;
- ldap_pvt_thread_mutex_t li_root_mutex;
- ldap_pvt_thread_mutex_t li_add_mutex;
- ldap_pvt_thread_mutex_t li_nextid_mutex;
+ /* DDD ldap_pvt_thread_mutex_t li_root_mutex; */
+ /* DDD ldap_pvt_thread_mutex_t li_add_mutex; */
+ /* DDD ldap_pvt_thread_mutex_t li_nextid_mutex; */
int li_mode;
char *li_directory;
struct cache li_cache;
int li_mode;
char *li_directory;
struct cache li_cache;
e->e_private = ch_calloc(1, sizeof(struct ldbm_entry_info));
e->e_private = ch_calloc(1, sizeof(struct ldbm_entry_info));
- if( cache_entry_rdwr_init( e ) != 0 ) {
- free( LEI(e) );
- e->e_private = NULL;
- return 1;
- }
+ /* DDD if( cache_entry_rdwr_init( e ) != 0 ) { */
+ /* DDD free( LEI(e) ); */
+ /* DDD e->e_private = NULL; */
+ /* DDD return 1; */
+ /* DDD } */
assert( e->e_private );
#endif
assert( e->e_private );
#endif
- cache_entry_rdwr_destroy( e );
+ /* DDD cache_entry_rdwr_destroy( e ); */
free( e->e_private );
e->e_private = NULL;
free( e->e_private );
e->e_private = NULL;
bdb2i_cache_return_entry_rw( struct cache *cache, Entry *e, int rw )
{
/* set cache mutex */
bdb2i_cache_return_entry_rw( struct cache *cache, Entry *e, int rw )
{
/* set cache mutex */
- ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &cache->c_mutex ); */
#ifdef LDAP_DEBUG
assert( e->e_private );
#endif
#ifdef LDAP_DEBUG
assert( e->e_private );
#endif
- cache_entry_rdwr_unlock(e, rw);
+ /* DDD cache_entry_rdwr_unlock(e, rw); */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
}
#define LRU_DELETE( cache, e ) { \
}
#define LRU_DELETE( cache, e ) { \
Entry *ee;
/* set cache mutex */
Entry *ee;
/* set cache mutex */
- ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &cache->c_mutex ); */
#ifdef LDAP_DEBUG
assert( e->e_private == NULL );
#ifdef LDAP_DEBUG
assert( e->e_private == NULL );
cache_entry_private_destroy(e);
/* free cache mutex */
cache_entry_private_destroy(e);
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
cache_entry_private_destroy(e);
/* free cache mutex */
cache_entry_private_destroy(e);
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
- cache_entry_rdwr_lock( e, rw );
+ /* DDD cache_entry_rdwr_lock( e, rw ); */
/* put the entry into 'CREATING' state */
/* will be marked after when entry is returned */
/* put the entry into 'CREATING' state */
/* will be marked after when entry is returned */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
Entry *ee;
/* set cache mutex */
Entry *ee;
/* set cache mutex */
- ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &cache->c_mutex ); */
#ifdef LDAP_DEBUG
assert( e->e_private );
#ifdef LDAP_DEBUG
assert( e->e_private );
e->e_id, e->e_dn, 0 );
/* free cache mutex */
e->e_id, e->e_dn, 0 );
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
ID id;
/* set cache mutex */
ID id;
/* set cache mutex */
- ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &cache->c_mutex ); */
e.e_dn = dn;
e.e_ndn = dn_normalize_case( ch_strdup( dn ) );
e.e_dn = dn;
e.e_ndn = dn_normalize_case( ch_strdup( dn ) );
dn, ep->e_id, LEI(ep)->lei_state);
/* free cache mutex */
dn, ep->e_id, LEI(ep)->lei_state);
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
id = ep->e_id;
/* free cache mutex */
id = ep->e_id;
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
free(e.e_ndn);
/* free cache mutex */
free(e.e_ndn);
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
try_again:
/* set cache mutex */
try_again:
/* set cache mutex */
- ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &cache->c_mutex ); */
if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e,
entry_id_cmp )) != NULL )
if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e,
entry_id_cmp )) != NULL )
id, ep->e_id, LEI(ep)->lei_state);
/* free cache mutex */
id, ep->e_id, LEI(ep)->lei_state);
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
id, rw ? "w" : "r", ep->e_dn);
/* acquire reader lock */
id, rw ? "w" : "r", ep->e_dn);
/* acquire reader lock */
- if ( cache_entry_rdwr_trylock(ep, rw) == LDAP_PVT_THREAD_EBUSY ) {
+ /* DDD if ( cache_entry_rdwr_trylock(ep, rw) == LDAP_PVT_THREAD_EBUSY ) { */
/* could not acquire entry lock...
* owner cannot free as we have the cache locked.
* so, unlock the cache, yield, and try again.
*/
/* free cache mutex */
/* could not acquire entry lock...
* owner cannot free as we have the cache locked.
* so, unlock the cache, yield, and try again.
*/
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
- ldap_pvt_thread_yield();
- goto try_again;
- }
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
+ /* DDD ldap_pvt_thread_yield(); */
+ /* DDD goto try_again; */
+ /* DDD } */
/* lru */
LRU_DELETE( cache, ep );
/* lru */
LRU_DELETE( cache, ep );
LEI(ep)->lei_refcnt++;
/* free cache mutex */
LEI(ep)->lei_refcnt++;
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
return( ep );
}
/* free cache mutex */
return( ep );
}
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
int rc;
/* set cache mutex */
int rc;
/* set cache mutex */
- ldap_pvt_thread_mutex_lock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &cache->c_mutex ); */
#ifdef LDAP_DEBUG
assert( e->e_private );
#ifdef LDAP_DEBUG
assert( e->e_private );
rc = cache_delete_entry_internal( cache, e );
/* free cache mutex */
rc = cache_delete_entry_internal( cache, e );
/* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->c_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &cache->c_mutex ); */
- ldap_pvt_thread_mutex_lock(&li->li_root_mutex);
+ /* DDD ldap_pvt_thread_mutex_lock(&li->li_root_mutex); */
if ( rootlock ) {
/* release root lock */
if ( rootlock ) {
/* release root lock */
- ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_root_mutex); */
}
/* free entry and writer lock */
}
/* free entry and writer lock */
free( argv[ 1 ] );
/* initialize various mutex locks & condition variables */
free( argv[ 1 ] );
/* initialize various mutex locks & condition variables */
- ldap_pvt_thread_mutex_init( &li->li_root_mutex );
- ldap_pvt_thread_mutex_init( &li->li_add_mutex );
- ldap_pvt_thread_mutex_init( &li->li_cache.c_mutex );
- ldap_pvt_thread_mutex_init( &li->li_nextid_mutex );
+ /* DDD ldap_pvt_thread_mutex_init( &li->li_root_mutex ); */
+ /* DDD ldap_pvt_thread_mutex_init( &li->li_add_mutex ); */
+ /* DDD ldap_pvt_thread_mutex_init( &li->li_cache.c_mutex ); */
+ /* DDD ldap_pvt_thread_mutex_init( &li->li_nextid_mutex ); */
/* initialize the TP file head */
if ( bdb2i_txn_head_init( &li->li_txn_head ) != 0 )
/* initialize the TP file head */
if ( bdb2i_txn_head_init( &li->li_txn_head ) != 0 )
- ldap_pvt_thread_mutex_lock(&li->li_root_mutex);
+ /* DDD ldap_pvt_thread_mutex_lock(&li->li_root_mutex); */
rootlock = 1;
new_dn = ch_strdup( newrdn );
rootlock = 1;
new_dn = ch_strdup( newrdn );
if ( rootlock ) {
/* release root writer lock */
if ( rootlock ) {
/* release root writer lock */
- ldap_pvt_thread_mutex_unlock(&li->li_root_mutex);
+ /* DDD ldap_pvt_thread_mutex_unlock(&li->li_root_mutex); */
}
/* free entry and writer lock */
}
/* free entry and writer lock */
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
- ldap_pvt_thread_mutex_lock( &li->li_nextid_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &li->li_nextid_mutex ); */
/* first time in here since startup - try to read the nexid */
if ( li->li_nextid == NOID ) {
/* first time in here since startup - try to read the nexid */
if ( li->li_nextid == NOID ) {
(void) next_id_write( be, li->li_nextid );
#endif
(void) next_id_write( be, li->li_nextid );
#endif
- ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex ); */
#ifdef SLAPD_NEXTID_RETURN
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
#ifdef SLAPD_NEXTID_RETURN
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
- ldap_pvt_thread_mutex_lock( &li->li_nextid_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &li->li_nextid_mutex ); */
if ( id != li->li_nextid - 1 ) {
if ( id != li->li_nextid - 1 ) {
- ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex ); */
(void) next_id_write( be, li->li_nextid );
#endif
(void) next_id_write( be, li->li_nextid );
#endif
- ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex ); */
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
ID id;
- ldap_pvt_thread_mutex_lock( &li->li_nextid_mutex );
+ /* DDD ldap_pvt_thread_mutex_lock( &li->li_nextid_mutex ); */
/* first time in here since startup - try to read the nexid */
if ( li->li_nextid == NOID ) {
/* first time in here since startup - try to read the nexid */
if ( li->li_nextid == NOID ) {
- ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex );
+ /* DDD ldap_pvt_thread_mutex_unlock( &li->li_nextid_mutex ); */
sleep 5
echo "Using tester for concurrent server access..."
sleep 5
echo "Using tester for concurrent server access..."
-$SLAPDTESTER -b "$BASEDN" -d "$DATADIR" -h localhost -p $PORT -D "$MANAGERDN" -w $PASSWD -l 100
+$SLAPDTESTER -b "$BASEDN" -d "$DATADIR" -h localhost -p $PORT -D "$MANAGERDN" -w $PASSWD -l 50
RC=$?
if [ $RC != 0 ]; then
RC=$?
if [ $RC != 0 ]; then
if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" );
if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" );
- fprintf( stderr, "Add/Delete(%d): entry=\"%s\".\n", maxloop, entry );
+ fprintf( stderr, "PID=%ld - Add/Delete(%d): entry=\"%s\".\n",
+ pid, maxloop, entry );
for ( i = 0; i < maxloop; i++ ) {
for ( i = 0; i < maxloop; i++ ) {
+ fprintf( stderr, " PID=%ld - Add/Delete done.\n", pid );
+
- do_read( host, port, entry, loops );
+ do_read( host, port, entry, ( 4 * loops ));
int i;
char *attrs[] = { "cn", "sn", NULL };
char *filter = "(objectclass=*)";
int i;
char *attrs[] = { "cn", "sn", NULL };
char *filter = "(objectclass=*)";
if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" );
if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" );
- fprintf( stderr, "Read(%d): entry=\"%s\".\n", maxloop, entry );
+ fprintf( stderr, "PID=%ld - Read(%d): entry=\"%s\".\n",
+ pid, maxloop, entry );
for ( i = 0; i < maxloop; i++ ) {
for ( i = 0; i < maxloop; i++ ) {
+ LDAPMessage *res;
+ int rc;
- if ( ldap_search_s( ld, entry, LDAP_SCOPE_BASE,
- filter, attrs, 0, &res ) != LDAP_SUCCESS ) {
+ if (( rc = ldap_search_s( ld, entry, LDAP_SCOPE_BASE,
+ filter, attrs, 0, &res )) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_read" );
ldap_perror( ld, "ldap_read" );
+ if ( rc != LDAP_NO_SUCH_OBJECT ) break;
+ continue;
+ fprintf( stderr, " PID=%ld - Read done.\n", pid );
+
- do_search( host, port, sbase, filter, loops );
+ do_search( host, port, sbase, filter, ( 4 * loops ));
LDAP *ld;
int i;
char *attrs[] = { "cn", "sn", NULL };
LDAP *ld;
int i;
char *attrs[] = { "cn", "sn", NULL };
if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" );
if (( ld = ldap_init( host, port )) == NULL ) {
perror( "ldap_init" );
- fprintf( stderr, "Search(%d): base=\"%s\", filter=\"%s\".\n",
- maxloop, sbase, filter );
+ fprintf( stderr, "PID=%ld - Search(%d): base=\"%s\", filter=\"%s\".\n",
+ pid, maxloop, sbase, filter );
for ( i = 0; i < maxloop; i++ ) {
for ( i = 0; i < maxloop; i++ ) {
+ LDAPMessage *res;
+ int rc;
- if ( ldap_search_s( ld, sbase, LDAP_SCOPE_SUBTREE,
- filter, attrs, 0, &res ) != LDAP_SUCCESS ) {
+ if (( rc = ldap_search_s( ld, sbase, LDAP_SCOPE_SUBTREE,
+ filter, attrs, 0, &res )) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_search" );
ldap_perror( ld, "ldap_search" );
+ if ( rc != LDAP_NO_SUCH_OBJECT ) break;
+ continue;
+ fprintf( stderr, " PID=%ld - Search done.\n", pid );
+