Patch for ITS# 1643

This commit is contained in:
Jong Hyuk Choi 2002-04-19 21:41:32 +00:00
parent e08bc054c7
commit 60b1ee1ba9
12 changed files with 75 additions and 6 deletions

View file

@ -151,6 +151,9 @@ retry: /* transaction retry */
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto retry;
case LDAP_BUSY:
text = "ldap server busy";
goto return_results;
default:
rc = LDAP_OTHER;
text = "internal error";

View file

@ -89,7 +89,7 @@ bdb_attribute(
if( txn != NULL ) {
boi->boi_err = rc;
}
return LDAP_OTHER;
return (rc != LDAP_BUSY) ? LDAP_OTHER : LDAP_BUSY;
}
if (e == NULL) {
#ifdef NEW_LOGGING

View file

@ -28,7 +28,9 @@ LDAP_BEGIN_DECL
#define bv2DBT(bv,t) ((t)->data = (bv)->bv_val, \
(t)->size = (bv)->bv_len )
#define BDB_TXN_RETRIES 16
#define BDB_TXN_RETRIES 16
#define BDB_MAX_ADD_LOOP 30
#ifdef BDB_SUBDIRS
#define BDB_TMP_SUBDIR LDAP_DIRSEP "tmp"

View file

@ -53,6 +53,10 @@ bdb_bind(
case DB_NOTFOUND:
case 0:
break;
case LDAP_BUSY:
send_ldap_result( conn, op, LDAP_BUSY,
NULL, "ldap server busy", NULL, NULL );
return LDAP_BUSY;
default:
send_ldap_result( conn, op, rc=LDAP_OTHER,
NULL, "internal error", NULL, NULL );

View file

@ -38,6 +38,9 @@ bdb_compare(
case DB_NOTFOUND:
case 0:
break;
case LDAP_BUSY:
text = "ldap server busy";
goto return_results;
default:
rc = LDAP_OTHER;
text = "internal error";

View file

@ -119,6 +119,9 @@ retry: /* transaction retry */
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto retry;
case LDAP_BUSY:
text = "ldap server busy";
goto return_results;
default:
rc = LDAP_OTHER;
text = "internal error";
@ -231,6 +234,9 @@ retry: /* transaction retry */
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto retry;
case LDAP_BUSY:
text = "ldap server busy";
goto return_results;
default:
rc = LDAP_OTHER;
text = "internal error";

View file

@ -121,14 +121,24 @@ int bdb_id2entry_rw(
ch_free( data.data );
}
if (rc == 0 && bdb_cache_add_entry_rw(&bdb->bi_cache, *e, rw) != 0) {
if ((*e)->e_private != NULL)
while (rc == 0 && bdb_cache_add_entry_rw(&bdb->bi_cache, *e, rw) != 0) {
Entry *ee;
int add_loop_cnt = 0;
if ( (*e)->e_private != NULL ) {
free ((*e)->e_private);
}
(*e)->e_private = NULL;
bdb_entry_return (*e);
if ((*e=bdb_cache_find_entry_id(&bdb->bi_cache,id,rw)) != NULL) {
if ( (ee = bdb_cache_find_entry_id
(&bdb->bi_cache, id, rw) ) != NULL) {
bdb_entry_return ( *e );
*e = ee;
return 0;
}
if ( ++add_loop_cnt == BDB_MAX_ADD_LOOP ) {
bdb_entry_return ( *e );
*e = NULL;
return LDAP_BUSY;
}
}
#ifdef BDB_HIER

View file

@ -318,6 +318,9 @@ retry: /* transaction retry */
goto retry;
case DB_NOTFOUND:
break;
case LDAP_BUSY:
text = "ldap server busy";
goto return_results;
default:
rc = LDAP_OTHER;
}

View file

@ -133,6 +133,9 @@ retry: /* transaction retry */
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto retry;
case LDAP_BUSY:
text = "ldap server busy";
goto return_results;
default:
rc = LDAP_OTHER;
text = "internal error";
@ -204,6 +207,9 @@ retry: /* transaction retry */
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto retry;
case LDAP_BUSY:
text = "ldap server busy";
goto return_results;
default:
rc = LDAP_OTHER;
text = "internal error";
@ -350,6 +356,9 @@ retry: /* transaction retry */
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto retry;
case LDAP_BUSY:
text = "ldap server busy";
goto return_results;
default:
rc = LDAP_OTHER;
text = "internal error";

View file

@ -159,6 +159,9 @@ retry: /* transaction retry */
case DB_NOTFOUND:
case 0:
break;
case LDAP_BUSY:
*text = "ldap server busy";
goto done;
default:
rc = LDAP_OTHER;
*text = "internal error";

View file

@ -43,6 +43,16 @@ bdb_referrals(
rc = 0;
case 0:
break;
case LDAP_BUSY:
if (e != NULL) {
bdb_cache_return_entry_r(&bdb->bi_cache, e);
}
if (matched != NULL) {
bdb_cache_return_entry_r(&bdb->bi_cache, matched);
}
send_ldap_result( conn, op, LDAP_BUSY,
NULL, "ldap server busy", NULL, NULL );
return LDAP_BUSY;
default:
#ifdef NEW_LOGGING
LDAP_LOG (( "referral", LDAP_LEVEL_ERR,

View file

@ -88,6 +88,16 @@ bdb_search(
case DB_NOTFOUND:
case 0:
break;
case LDAP_BUSY:
if (e != NULL) {
bdb_cache_return_entry_r(&bdb->bi_cache, e);
}
if (matched != NULL) {
bdb_cache_return_entry_r(&bdb->bi_cache, matched);
}
send_ldap_result( conn, op, LDAP_BUSY,
NULL, "ldap server busy", NULL, NULL );
return LDAP_BUSY;
default:
if (e != NULL) {
bdb_cache_return_entry_r(&bdb->bi_cache, e);
@ -313,6 +323,12 @@ bdb_search(
/* get the entry with reader lock */
rc = bdb_id2entry_r( be, NULL, id, &e );
if (rc == LDAP_BUSY) {
send_ldap_result( conn, op, rc=LDAP_BUSY,
NULL, "ldap server busy", NULL, NULL );
goto done;
}
if ( e == NULL ) {
if( !BDB_IDL_IS_RANGE(candidates) ) {
/* only complain for non-range IDLs */